From 5bd38073330c4ef9e5710f394365db55782abd3c Mon Sep 17 00:00:00 2001 From: Alfonso Bribiesca Date: Sat, 25 Aug 2018 12:40:51 -0500 Subject: [PATCH] NovaTrumbowyg v1 --- .gitignore | 11 ++++ LICENSE | 21 +++++++ README.md | 30 ++++++++++ composer.json | 30 ++++++++++ docs/sh1.png | Bin 0 -> 23806 bytes fonts/vendor/trumbowyg/dist/ui/icons.svg | 1 + mix-manifest.json | 5 ++ package.json | 21 +++++++ resources/js/components/DetailField.vue | 19 ++++++ resources/js/components/Excerpt.vue | 33 +++++++++++ resources/js/components/FormField.vue | 71 +++++++++++++++++++++++ resources/js/components/IndexField.vue | 23 ++++++++ resources/js/field.js | 5 ++ resources/sass/field.scss | 1 + src/FieldServiceProvider.php | 34 +++++++++++ src/NovaTrumbowyg.php | 48 +++++++++++++++ webpack.mix.js | 18 ++++++ 17 files changed, 371 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 composer.json create mode 100644 docs/sh1.png create mode 100644 fonts/vendor/trumbowyg/dist/ui/icons.svg create mode 100644 mix-manifest.json create mode 100644 package.json create mode 100644 resources/js/components/DetailField.vue create mode 100755 resources/js/components/Excerpt.vue create mode 100644 resources/js/components/FormField.vue create mode 100644 resources/js/components/IndexField.vue create mode 100644 resources/js/field.js create mode 100644 resources/sass/field.scss create mode 100644 src/FieldServiceProvider.php create mode 100644 src/NovaTrumbowyg.php create mode 100644 webpack.mix.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d918156 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +/dist +/.idea +/vendor +/node_modules +package-lock.json +composer.phar +composer.lock +phpunit.xml +.phpunit.result.cache +.DS_Store +Thumbs.db diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5f988aa --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Alfonso Bribiesca + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..fef4dd8 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Nova Trumbowyg editor field +Laravel Nova Trumbowyg Editor field. + +## Installation + +Just install the package in to a Laravel app that uses Nova via composer: + +``` +composer require alfonsobries/nova-trumbowyg +``` + + +## Simple Usage: +```php +NovaTrumbowyg::make('Field Name') +``` + +## Advanced Usage: +You can pass any existing Trumbowyg option. Consult the [Trumbowyg documentation](https://alex-d.github.io/Trumbowyg/documentation/#basic-options) to view the list of all the available options. + +```php +NovaFroalaEditor::make('Description') + ->options(['btns' => [['bold', 'italic'], ['link']]]) +``` + +## Screenshot +![Froala editor](./docs/sh1.png) + +## License +The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..3244d18 --- /dev/null +++ b/composer.json @@ -0,0 +1,30 @@ +{ + "name": "alfonsobries/nova-trumbowyg", + "description": "A Laravel Trumbowyg Nova field.", + "keywords": [ + "laravel", + "nova", + "trumbowyg" + ], + "license": "MIT", + "require": { + "php": ">=7.1.0" + }, + "autoload": { + "psr-4": { + "Alfonsobries\\NovaTrumbowyg\\": "src/" + } + }, + "extra": { + "laravel": { + "providers": [ + "Alfonsobries\\NovaTrumbowyg\\FieldServiceProvider" + ] + } + }, + "config": { + "sort-packages": true + }, + "minimum-stability": "dev", + "prefer-stable": true +} diff --git a/docs/sh1.png b/docs/sh1.png new file mode 100644 index 0000000000000000000000000000000000000000..2d7dd4d079efec5ad758f60bfe4796e3248ff83e GIT binary patch literal 23806 zcmeFZXH=6*8#by`MFABR0V#rjfb=FU6h%5HRk}(Iq4yR-5m7*pPJj@UCSAG^swlmO z8mdwPgn*PJ)bPdqZufrIIX})hYn`7jKeCc}X6Bi4&pp?D%{9DzqN_$r!%TDT+&Nke z^+)>W&XK{-ojad?fr^wuLHSmY^dlJf@Zl4UhYvZPc)HmGo$bz@yO&_|{5ikI{d?Un zUOa!^Js`kGEnIAgb3cXqsy=*M87B zoOG(ZvCgu0rg*XUKvd-O{PEdYH8VN+@m;Fdtqf;pXU%J8XRR?|c=Dx9CAxEW{eX+H zplkG`d4K^8pLsvi(U!Gwa}j!B>-N%4$lt}CG*9Qw$@|NazPi|Xzu@q9ad!2R^;h8h zD~BxU`|o67PL98_c!Lx;pXof|csAtb^HpyA-)koUB;m(_pt`0wJRUkaR# z-rnxA!oq%jenNiYLT;W8!lE)VGQuKa!eU~Aq#S}?0j}OJ`~_XTxc*bgpL!nIdD(aZ z-MxWst{lJXeeu%G$6JAu^Y@GX`TI{h?filNzRA_=?{1MgDE#}0u&9uT@IQ5vipu{^ zm3;#Aw{w2>2P317KuTIv{;&N1w6VH|Z zZ?XTE6)|)pm7aAjey*eEef*!+a=hOp zHKj*aGwk0k{Ghl1_+OsC$K!wF^Z#fYOi9h(Z14YCh@iGZu9gw6RonM)M$)XN-JY&K z-qSzs`_XaM15t}p&z@~av`B&YZYGBx?r9wDpXk1~)u#D-Erq3Df3v>mwSLUrC%sUS zC?B9p<;%Q=oq;IruJ#DB3cCu{78~jMj5S=k*$0QXq{=j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TOeD41aT1YR23J@9k%8S3K&a z^rL60wxcaP9SAVF*BsByJ67V!ar<12VNi$iQXjEeyWnFp7sF2o4de_ld!HUJYOwK7 z{{MM3J#o6>i9bueFEc)+F~_p~i+-S~M*XX0?^DlT{Qsviv{?LGz5iQ%mia4dSuO0~ zX;tCEvV@rn9(?Y$ot>+2^E}Ipg-z$ZyQkPEcP+iX?VpTD%{HUIZpo^u3;&vh`88I- zEl=-v`0ezx$ zda7p*ELr-D*Ij&f)AgpAn>~NZ{PdSsn7UuEX4xm!2Or>(vY=t#*%wb|#V$Es{`v1s ztGE}pOue6ezFU9tujnlA>q>?HN`F0l@Nx0CweGv-vdwR7eBF~J+q}*9Eh}(g^gbpT z&}b&4B<9?5BHnAAMwn;ZU8z4BwcnnZ8eQLWamA`k*0u9?cgUFbKM9|mIi>E-e&>JI zg+4`TCv+BH*AuS2zI$1t>MHN%Jzm3%Kh%8au_eO|$2FJ8}K@9L}iv z8!R)eo~N&FYKb_ah<_4g~7Nu)cyN9F83@G9`Ac>>KDPH+v`yiMkBGE2XdDb|qbaLbJuA}v0_jVVt!166aBL~wjj@snaub-x0-v0Tn?Ecg3 zyUkABVzz!OH?>G?N?4kfsw`{#!JaJt^ncw?fl2#xc>6B6eal%)maLhwdcj}gJwAI) zULQ*S4%y}d_5Xx#pmnVGOcx)62goc@pp!RG@9P4M!h%IJ{ec@*-o_ed^*{xX_X|;M zklIXtkZtqdGQGaG*7~;p#LwU}H7wXctJDv6pVK_P&mkrz=1uq{DafI66F3; z#=s6I6EiqpvPIzaoL`(elF{r5}E)oaZxS+ literal 0 HcmV?d00001 diff --git a/fonts/vendor/trumbowyg/dist/ui/icons.svg b/fonts/vendor/trumbowyg/dist/ui/icons.svg new file mode 100644 index 0000000..269c8df --- /dev/null +++ b/fonts/vendor/trumbowyg/dist/ui/icons.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/mix-manifest.json b/mix-manifest.json new file mode 100644 index 0000000..b64e53f --- /dev/null +++ b/mix-manifest.json @@ -0,0 +1,5 @@ +{ + "/dist/js/field.js": "/dist/js/field.js", + "/dist/css/field.css": "/dist/css/field.css", + "/dist/img/icons.svg": "/dist/img/icons.svg" +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..14e417e --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "private": true, + "scripts": { + "dev": "npm run development", + "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "watch-poll": "npm run watch -- --watch-poll", + "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", + "prod": "npm run production", + "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" + }, + "devDependencies": { + "cross-env": "^5.0.0", + "laravel-mix": "^1.0", + "laravel-nova": "^1.0" + }, + "dependencies": { + "vue": "^2.5.0", + "vue-trumbowyg": "^3.4.0" + } +} diff --git a/resources/js/components/DetailField.vue b/resources/js/components/DetailField.vue new file mode 100644 index 0000000..51baf10 --- /dev/null +++ b/resources/js/components/DetailField.vue @@ -0,0 +1,19 @@ + + + diff --git a/resources/js/components/Excerpt.vue b/resources/js/components/Excerpt.vue new file mode 100755 index 0000000..cf10556 --- /dev/null +++ b/resources/js/components/Excerpt.vue @@ -0,0 +1,33 @@ + + + diff --git a/resources/js/components/FormField.vue b/resources/js/components/FormField.vue new file mode 100644 index 0000000..9bb36a7 --- /dev/null +++ b/resources/js/components/FormField.vue @@ -0,0 +1,71 @@ + + + diff --git a/resources/js/components/IndexField.vue b/resources/js/components/IndexField.vue new file mode 100644 index 0000000..fe750d1 --- /dev/null +++ b/resources/js/components/IndexField.vue @@ -0,0 +1,23 @@ + + + diff --git a/resources/js/field.js b/resources/js/field.js new file mode 100644 index 0000000..4332733 --- /dev/null +++ b/resources/js/field.js @@ -0,0 +1,5 @@ +Nova.booting((Vue, router) => { + Vue.component('index-nova-trumbowyg', require('./components/IndexField')); + Vue.component('detail-nova-trumbowyg', require('./components/DetailField')); + Vue.component('form-nova-trumbowyg', require('./components/FormField')); +}) diff --git a/resources/sass/field.scss b/resources/sass/field.scss new file mode 100644 index 0000000..f85ad40 --- /dev/null +++ b/resources/sass/field.scss @@ -0,0 +1 @@ +// Nova Tool CSS diff --git a/src/FieldServiceProvider.php b/src/FieldServiceProvider.php new file mode 100644 index 0000000..11d313e --- /dev/null +++ b/src/FieldServiceProvider.php @@ -0,0 +1,34 @@ +withMeta([ + 'options' => [ + 'btns' => [ + ['bold', 'italic'], + ['unorderedList', 'orderedList'], + ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'], + ['link', 'insertImage'], + ], + ] + ]); + } + + /** + * Allow to pass any existing Trumbowyg option to the editor. + * Consult the Trumbowyg documentation [https://alex-d.github.io/Trumbowyg/documentation/#basic-options] + * to view the list of all the available options. + * + * @param array $options + * @return self + */ + public function options(array $options) + { + $currentOptions = $this->meta['options']; + + return $this->withMeta([ + 'options' => array_merge($currentOptions, $options) + ]); + } +} diff --git a/webpack.mix.js b/webpack.mix.js new file mode 100644 index 0000000..b3b055c --- /dev/null +++ b/webpack.mix.js @@ -0,0 +1,18 @@ +let webpack = require('webpack') +let mix = require('laravel-mix') + +mix.js('resources/js/field.js', 'dist/js') + .sass('resources/sass/field.scss', 'dist/css') + .copy('node_modules/trumbowyg/dist/ui/icons.svg', 'dist/img') + .webpackConfig({ + resolve: { + symlinks: false + }, + plugins: [ + // Jquery loader plugin. + new webpack.ProvidePlugin({ + $: "jquery", + jQuery: "jquery" + }) + ] + })