promethee 1.4.8 → 1.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -6
- data/app/assets/javascripts/promethee.js +4 -0
- data/app/assets/stylesheets/promethee-edit.sass +1 -0
- data/config/initializers/assets.rb +1 -0
- data/lib/promethee/rails/version.rb +1 -1
- data/node_modules/angular-summernote/CHANGELOG.md +149 -0
- data/node_modules/angular-summernote/LICENSE-MIT +22 -0
- data/node_modules/angular-summernote/README.md +270 -0
- data/node_modules/angular-summernote/bower.json +49 -0
- data/{vendor/assets/javascripts → node_modules/angular-summernote/dist}/angular-summernote.js +0 -0
- data/node_modules/angular-summernote/dist/angular-summernote.min.js +2 -0
- data/node_modules/angular-summernote/examples/fontstyle-plugin.html +48 -0
- data/node_modules/angular-summernote/examples/index.html +180 -0
- data/node_modules/angular-summernote/examples/index2.html +60 -0
- data/node_modules/angular-summernote/examples/index3.html +57 -0
- data/node_modules/angular-summernote/gulpfile.js +115 -0
- data/node_modules/angular-summernote/package.json +53 -0
- data/node_modules/angular-summernote/src/angular-summernote.js +206 -0
- data/node_modules/angular-summernote/test/angular-summernote.test.js +660 -0
- data/node_modules/angular-summernote/test/chai.conf.js +6 -0
- data/node_modules/angular-summernote/test/coverage/Chrome 37.0.2062 (Mac OS X 10.9.4)/index.html +350 -0
- data/node_modules/angular-summernote/test/coverage/Chrome 37.0.2062 (Mac OS X 10.9.4)/prettify.css +1 -0
- data/node_modules/angular-summernote/test/coverage/Chrome 37.0.2062 (Mac OS X 10.9.4)/prettify.js +1 -0
- data/node_modules/angular-summernote/test/coverage/Chrome 37.0.2062 (Mac OS X 10.9.4)/src/angular-summernote.js.html +694 -0
- data/node_modules/angular-summernote/test/coverage/Chrome 37.0.2062 (Mac OS X 10.9.4)/src/index.html +350 -0
- data/node_modules/angular-summernote/test/karma-angular-1-2-x.conf.js +33 -0
- data/node_modules/angular-summernote/test/karma-angular-1-3-x.conf.js +33 -0
- data/node_modules/angular-summernote/test/karma-angular-1-4-x.conf.js +33 -0
- data/node_modules/angular-summernote/test/karma-shared.conf.js +64 -0
- data/node_modules/angular-summernote/test/karma.conf.js +33 -0
- data/{vendor/assets/javascripts/summernote/locales/de-DE.js → node_modules/angular-summernote/test/lang/summernote-de-DE.js} +2 -17
- data/node_modules/angular-summernote/test/mocha.conf.js +3 -0
- data/node_modules/angular-ui-sortable/API.md +84 -0
- data/node_modules/angular-ui-sortable/CONTRIBUTING.md +12 -0
- data/node_modules/angular-ui-sortable/LICENSE +21 -0
- data/node_modules/angular-ui-sortable/README.md +350 -0
- data/node_modules/angular-ui-sortable/bower.json +26 -0
- data/node_modules/angular-ui-sortable/demo/demo.css +34 -0
- data/node_modules/angular-ui-sortable/demo/demo.html +29 -0
- data/node_modules/angular-ui-sortable/demo/demo.js +41 -0
- data/node_modules/angular-ui-sortable/dist/sortable.js +593 -0
- data/node_modules/angular-ui-sortable/dist/sortable.min.js +8 -0
- data/node_modules/angular-ui-sortable/gruntFile.js +202 -0
- data/node_modules/angular-ui-sortable/package.json +48 -0
- data/node_modules/angular-ui-sortable/publish.js +41 -0
- data/{vendor/assets/javascripts/ui-sortable.js → node_modules/angular-ui-sortable/src/sortable.js} +106 -200
- data/node_modules/angular-ui-sortable/test/bower_overrides.json +13 -0
- data/node_modules/angular-ui-sortable/test/karma.conf.js +85 -0
- data/node_modules/angular-ui-sortable/test/libs/jquery.simulate.dragandrevert.js +60 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.callbacks.attr.spec.js +199 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.callbacks.spec.js +729 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.directiveoptions.spec.js +554 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.directives.spec.js +371 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.events.spec.js +167 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.multi.spec.js +1232 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.nested.spec.js +186 -0
- data/node_modules/angular-ui-sortable/test/sortable.e2e.spec.js +895 -0
- data/node_modules/angular-ui-sortable/test/sortable.spec.js +440 -0
- data/node_modules/angular-ui-sortable/test/sortable.test-directives.js +54 -0
- data/node_modules/angular-ui-sortable/test/sortable.test-helper.js +114 -0
- data/node_modules/angular-ui-sortable/test/sortable.tests.css +12 -0
- data/node_modules/ng-file-upload/LICENSE +20 -0
- data/node_modules/ng-file-upload/README.md +616 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/FileAPI.flash.swf +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/FileAPI.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/FileAPI.min.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/ng-file-upload-all.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/ng-file-upload-all.min.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/ng-file-upload-shim.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/ng-file-upload-shim.min.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/ng-file-upload.js +0 -0
- data/{vendor/assets/javascripts/ng-file-upload → node_modules/ng-file-upload/dist}/ng-file-upload.min.js +0 -0
- data/node_modules/ng-file-upload/index.js +2 -0
- data/node_modules/ng-file-upload/package.json +42 -0
- data/node_modules/summernote/CODE_OF_CONDUCT.md +46 -0
- data/node_modules/summernote/CONTRIBUTING.md +67 -0
- data/node_modules/summernote/ISSUE_TEMPLATE.md +14 -0
- data/node_modules/summernote/LICENSE +21 -0
- data/node_modules/summernote/PULL_REQUEST_TEMPLATE.md +28 -0
- data/node_modules/summernote/README.md +90 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/base.css +213 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/index.html +262 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/prettify.css +1 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/prettify.js +1 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/sort-arrow-sprite.png +0 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/sorter.js +158 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/Context.js.html +758 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/async.js.html +206 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/dom.js.html +3329 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/env.js.html +386 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/func.js.html +551 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/index.html +171 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/key.js.html +341 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/lists.js.html +695 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/core/range.js.html +2441 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/editing/Bullet.js.html +668 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/editing/History.js.html +380 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/editing/Style.js.html +539 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/editing/Table.js.html +1787 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/editing/Typing.js.html +335 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/editing/index.html +145 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/index.html +119 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/AirPopover.js.html +284 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/AutoLink.js.html +248 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/AutoSync.js.html +122 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Buttons.js.html +2504 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Clipboard.js.html +149 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Codeview.js.html +434 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Dropzone.js.html +410 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Editor.js.html +2648 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Fullscreen.js.html +218 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Handle.js.html +494 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/HelpDialog.js.html +302 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/HintPopover.js.html +743 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/ImageDialog.js.html +458 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/ImagePopover.js.html +239 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/LinkDialog.js.html +587 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/LinkPopover.js.html +272 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Placeholder.js.html +182 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Statusbar.js.html +191 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/TablePopover.js.html +278 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/Toolbar.js.html +473 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/VideoDialog.js.html +680 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/module/index.html +353 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/renderer.js.html +263 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/base/summernote-en-US.js.html +542 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/bs3/index.html +106 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/bs3/settings.js.html +956 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/bs3/ui.js.html +776 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/bs4/index.html +106 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/bs4/settings.js.html +968 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/bs4/ui.js.html +791 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/index.html +93 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/index.html +106 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/settings.js.html +953 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/ui.js.html +1919 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/ui/DropdownUI.js.html +260 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/ui/ModalUI.js.html +167 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/ui/PopoverUI.js.html +347 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/ui/TooltipUI.js.html +344 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/lite/ui/index.html +132 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/src/js/summernote.js.html +203 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/Context.spec.js.html +323 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/core/dom.spec.js.html +1046 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/core/func.spec.js.html +482 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/core/index.html +145 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/core/key.spec.js.html +140 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/core/lists.spec.js.html +419 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/core/range.spec.js.html +1286 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/editing/Table.spec.js.html +1724 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/editing/index.html +106 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/editing/style.spec.js.html +341 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/index.html +93 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/module/Codeview.spec.js.html +161 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/module/Editor.spec.js.html +1235 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/module/Fullscreen.spec.js.html +161 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/base/module/index.html +119 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/bs/module/Buttons.spec.js.html +770 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/bs/module/VideoDialog.spec.js.html +209 -0
- data/node_modules/summernote/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/test/unit/bs/module/index.html +106 -0
- data/node_modules/summernote/dist/font/summernote.eot +0 -0
- data/node_modules/summernote/dist/font/summernote.ttf +0 -0
- data/node_modules/summernote/dist/font/summernote.woff +0 -0
- data/{vendor/assets/javascripts/summernote/locales/ar-AR.js → node_modules/summernote/dist/lang/summernote-ar-AR.js} +55 -4
- data/node_modules/summernote/dist/lang/summernote-ar-AR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/bg-BG.js → node_modules/summernote/dist/lang/summernote-bg-BG.js} +60 -4
- data/node_modules/summernote/dist/lang/summernote-bg-BG.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/ca-ES.js → node_modules/summernote/dist/lang/summernote-ca-ES.js} +12 -4
- data/node_modules/summernote/dist/lang/summernote-ca-ES.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/cs-CZ.js → node_modules/summernote/dist/lang/summernote-cs-CZ.js} +50 -4
- data/node_modules/summernote/dist/lang/summernote-cs-CZ.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/da-DK.js → node_modules/summernote/dist/lang/summernote-da-DK.js} +46 -5
- data/node_modules/summernote/dist/lang/summernote-da-DK.min.js +3 -0
- data/node_modules/summernote/dist/lang/summernote-de-DE.js +154 -0
- data/node_modules/summernote/dist/lang/summernote-de-DE.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/el-GR.js → node_modules/summernote/dist/lang/summernote-el-GR.js} +11 -3
- data/node_modules/summernote/dist/lang/summernote-el-GR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/es-ES.js → node_modules/summernote/dist/lang/summernote-es-ES.js} +12 -4
- data/node_modules/summernote/dist/lang/summernote-es-ES.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/es-EU.js → node_modules/summernote/dist/lang/summernote-es-EU.js} +55 -4
- data/node_modules/summernote/dist/lang/summernote-es-EU.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/fa-IR.js → node_modules/summernote/dist/lang/summernote-fa-IR.js} +55 -5
- data/node_modules/summernote/dist/lang/summernote-fa-IR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/fi-FI.js → node_modules/summernote/dist/lang/summernote-fi-FI.js} +52 -3
- data/node_modules/summernote/dist/lang/summernote-fi-FI.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/fr-FR.js → node_modules/summernote/dist/lang/summernote-fr-FR.js} +3 -2
- data/node_modules/summernote/dist/lang/summernote-fr-FR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/gl-ES.js → node_modules/summernote/dist/lang/summernote-gl-ES.js} +12 -4
- data/node_modules/summernote/dist/lang/summernote-gl-ES.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/he-IL.js → node_modules/summernote/dist/lang/summernote-he-IL.js} +51 -3
- data/node_modules/summernote/dist/lang/summernote-he-IL.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/hr-HR.js → node_modules/summernote/dist/lang/summernote-hr-HR.js} +54 -3
- data/node_modules/summernote/dist/lang/summernote-hr-HR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/hu-HU.js → node_modules/summernote/dist/lang/summernote-hu-HU.js} +25 -5
- data/node_modules/summernote/dist/lang/summernote-hu-HU.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/id-ID.js → node_modules/summernote/dist/lang/summernote-id-ID.js} +56 -4
- data/node_modules/summernote/dist/lang/summernote-id-ID.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/it-IT.js → node_modules/summernote/dist/lang/summernote-it-IT.js} +55 -4
- data/node_modules/summernote/dist/lang/summernote-it-IT.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/ja-JP.js → node_modules/summernote/dist/lang/summernote-ja-JP.js} +32 -10
- data/node_modules/summernote/dist/lang/summernote-ja-JP.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/ko-KR.js → node_modules/summernote/dist/lang/summernote-ko-KR.js} +44 -4
- data/node_modules/summernote/dist/lang/summernote-ko-KR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/lt-LT.js → node_modules/summernote/dist/lang/summernote-lt-LT.js} +52 -4
- data/node_modules/summernote/dist/lang/summernote-lt-LT.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/lt-LV.js → node_modules/summernote/dist/lang/summernote-lt-LV.js} +27 -7
- data/node_modules/summernote/dist/lang/summernote-lt-LV.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/mn-MN.js → node_modules/summernote/dist/lang/summernote-mn-MN.js} +43 -4
- data/node_modules/summernote/dist/lang/summernote-mn-MN.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/nb-NO.js → node_modules/summernote/dist/lang/summernote-nb-NO.js} +53 -3
- data/node_modules/summernote/dist/lang/summernote-nb-NO.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/nl-NL.js → node_modules/summernote/dist/lang/summernote-nl-NL.js} +55 -4
- data/node_modules/summernote/dist/lang/summernote-nl-NL.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/pl-PL.js → node_modules/summernote/dist/lang/summernote-pl-PL.js} +46 -3
- data/node_modules/summernote/dist/lang/summernote-pl-PL.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/pt-BR.js → node_modules/summernote/dist/lang/summernote-pt-BR.js} +25 -8
- data/node_modules/summernote/dist/lang/summernote-pt-BR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/pt-PT.js → node_modules/summernote/dist/lang/summernote-pt-PT.js} +54 -3
- data/node_modules/summernote/dist/lang/summernote-pt-PT.min.js +3 -0
- data/node_modules/summernote/dist/lang/summernote-ro-RO.js +155 -0
- data/node_modules/summernote/dist/lang/summernote-ro-RO.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/ru-RU.js → node_modules/summernote/dist/lang/summernote-ru-RU.js} +46 -3
- data/node_modules/summernote/dist/lang/summernote-ru-RU.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/sk-SK.js → node_modules/summernote/dist/lang/summernote-sk-SK.js} +54 -3
- data/node_modules/summernote/dist/lang/summernote-sk-SK.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/sl-SI.js → node_modules/summernote/dist/lang/summernote-sl-SI.js} +53 -4
- data/node_modules/summernote/dist/lang/summernote-sl-SI.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/sr-RS-Latin.js → node_modules/summernote/dist/lang/summernote-sr-RS-Latin.js} +54 -3
- data/node_modules/summernote/dist/lang/summernote-sr-RS-Latin.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/sr-RS.js → node_modules/summernote/dist/lang/summernote-sr-RS.js} +54 -3
- data/node_modules/summernote/dist/lang/summernote-sr-RS.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/sv-SE.js → node_modules/summernote/dist/lang/summernote-sv-SE.js} +55 -4
- data/node_modules/summernote/dist/lang/summernote-sv-SE.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/ta-IN.js → node_modules/summernote/dist/lang/summernote-ta-IN.js} +46 -4
- data/node_modules/summernote/dist/lang/summernote-ta-IN.min.js +3 -0
- data/node_modules/summernote/dist/lang/summernote-th-TH.js +155 -0
- data/node_modules/summernote/dist/lang/summernote-th-TH.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/tr-TR.js → node_modules/summernote/dist/lang/summernote-tr-TR.js} +3 -2
- data/node_modules/summernote/dist/lang/summernote-tr-TR.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/uk-UA.js → node_modules/summernote/dist/lang/summernote-uk-UA.js} +48 -4
- data/node_modules/summernote/dist/lang/summernote-uk-UA.min.js +3 -0
- data/node_modules/summernote/dist/lang/summernote-uz-UZ.js +112 -0
- data/node_modules/summernote/dist/lang/summernote-uz-UZ.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/vi-VN.js → node_modules/summernote/dist/lang/summernote-vi-VN.js} +55 -4
- data/node_modules/summernote/dist/lang/summernote-vi-VN.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/zh-CN.js → node_modules/summernote/dist/lang/summernote-zh-CN.js} +20 -7
- data/node_modules/summernote/dist/lang/summernote-zh-CN.min.js +3 -0
- data/{vendor/assets/javascripts/summernote/locales/zh-TW.js → node_modules/summernote/dist/lang/summernote-zh-TW.js} +45 -3
- data/node_modules/summernote/dist/lang/summernote-zh-TW.min.js +3 -0
- data/node_modules/summernote/dist/summernote-0.8.10-dist.zip +0 -0
- data/node_modules/summernote/dist/summernote-bs4.css +1 -0
- data/node_modules/summernote/dist/summernote-bs4.js +7323 -0
- data/node_modules/summernote/dist/summernote-bs4.js.map +1 -0
- data/node_modules/summernote/dist/summernote-bs4.min.js +3 -0
- data/node_modules/summernote/dist/summernote-lite.css +1 -0
- data/node_modules/summernote/dist/summernote-lite.js +7837 -0
- data/node_modules/summernote/dist/summernote-lite.js.map +1 -0
- data/node_modules/summernote/dist/summernote.css +1 -0
- data/node_modules/summernote/dist/summernote.js +7315 -0
- data/node_modules/summernote/dist/summernote.js.map +1 -0
- data/node_modules/summernote/dist/summernote.min.js +3 -0
- data/node_modules/summernote/examples/airmode.html +35 -0
- data/node_modules/summernote/examples/bs3.html +60 -0
- data/node_modules/summernote/examples/bs4.html +57 -0
- data/node_modules/summernote/examples/codemirror.html +45 -0
- data/node_modules/summernote/examples/external-api.html +76 -0
- data/node_modules/summernote/examples/hint-emoji.html +61 -0
- data/node_modules/summernote/examples/hint-symbols_mathematical-symbols_Greek-letters.html +54 -0
- data/node_modules/summernote/examples/hint-userdefine.html +48 -0
- data/node_modules/summernote/examples/ie8.html +32 -0
- data/node_modules/summernote/examples/jquery-custom-event.html +119 -0
- data/node_modules/summernote/examples/jquery19lt.html +25 -0
- data/node_modules/summernote/examples/lang.html +33 -0
- data/node_modules/summernote/examples/link-blank.html +33 -0
- data/node_modules/summernote/examples/lite.html +24 -0
- data/node_modules/summernote/examples/nativestyle.html +32 -0
- data/node_modules/summernote/examples/ondialog-multitab.html +77 -0
- data/node_modules/summernote/examples/ondialog.html +58 -0
- data/node_modules/summernote/examples/plugin-hello.html +37 -0
- data/node_modules/summernote/examples/rtl.html +32 -0
- data/node_modules/summernote/examples/symbols_mathematical-symbols_Greek-letters.json +1118 -0
- data/node_modules/summernote/examples/textarea.html +46 -0
- data/node_modules/summernote/examples/toolbar-container.html +35 -0
- data/node_modules/summernote/examples/with-google-font.html +50 -0
- data/node_modules/summernote/index.html +33 -0
- data/node_modules/summernote/karma.conf.js +42 -0
- data/node_modules/summernote/lang/summernote-ar-AR.js +155 -0
- data/node_modules/summernote/lang/summernote-bg-BG.js +155 -0
- data/node_modules/summernote/lang/summernote-ca-ES.js +155 -0
- data/node_modules/summernote/lang/summernote-cs-CZ.js +149 -0
- data/node_modules/summernote/lang/summernote-da-DK.js +155 -0
- data/node_modules/summernote/lang/summernote-de-DE.js +154 -0
- data/node_modules/summernote/lang/summernote-el-GR.js +155 -0
- data/node_modules/summernote/lang/summernote-es-ES.js +155 -0
- data/node_modules/summernote/lang/summernote-es-EU.js +154 -0
- data/node_modules/summernote/lang/summernote-fa-IR.js +155 -0
- data/node_modules/summernote/lang/summernote-fi-FI.js +153 -0
- data/node_modules/summernote/lang/summernote-fr-FR.js +155 -0
- data/node_modules/summernote/lang/summernote-gl-ES.js +155 -0
- data/node_modules/summernote/lang/summernote-he-IL.js +155 -0
- data/node_modules/summernote/lang/summernote-hr-HR.js +155 -0
- data/node_modules/summernote/lang/summernote-hu-HU.js +155 -0
- data/node_modules/summernote/lang/summernote-id-ID.js +155 -0
- data/node_modules/summernote/lang/summernote-it-IT.js +155 -0
- data/node_modules/summernote/lang/summernote-ja-JP.js +155 -0
- data/node_modules/summernote/lang/summernote-ko-KR.js +155 -0
- data/node_modules/summernote/lang/summernote-lt-LT.js +155 -0
- data/node_modules/summernote/lang/summernote-lt-LV.js +155 -0
- data/node_modules/summernote/lang/summernote-mn-MN.js +157 -0
- data/node_modules/summernote/lang/summernote-nb-NO.js +154 -0
- data/node_modules/summernote/lang/summernote-nl-NL.js +155 -0
- data/node_modules/summernote/lang/summernote-pl-PL.js +155 -0
- data/node_modules/summernote/lang/summernote-pt-BR.js +155 -0
- data/node_modules/summernote/lang/summernote-pt-PT.js +154 -0
- data/node_modules/summernote/lang/summernote-ro-RO.js +155 -0
- data/node_modules/summernote/lang/summernote-ru-RU.js +155 -0
- data/node_modules/summernote/lang/summernote-sk-SK.js +153 -0
- data/node_modules/summernote/lang/summernote-sl-SI.js +155 -0
- data/node_modules/summernote/lang/summernote-sr-RS-Latin.js +155 -0
- data/node_modules/summernote/lang/summernote-sr-RS.js +155 -0
- data/node_modules/summernote/lang/summernote-sv-SE.js +155 -0
- data/node_modules/summernote/lang/summernote-ta-IN.js +155 -0
- data/node_modules/summernote/lang/summernote-th-TH.js +155 -0
- data/node_modules/summernote/lang/summernote-tr-TR.js +155 -0
- data/node_modules/summernote/lang/summernote-uk-UA.js +155 -0
- data/node_modules/summernote/lang/summernote-uz-UZ.js +112 -0
- data/node_modules/summernote/lang/summernote-vi-VN.js +155 -0
- data/node_modules/summernote/lang/summernote-zh-CN.js +155 -0
- data/node_modules/summernote/lang/summernote-zh-TW.js +155 -0
- data/node_modules/summernote/package.json +87 -0
- data/{vendor/assets/javascripts → node_modules}/summernote/plugin/databasic/summernote-ext-databasic.css +0 -0
- data/{vendor/assets/javascripts → node_modules}/summernote/plugin/databasic/summernote-ext-databasic.js +62 -73
- data/{vendor/assets/javascripts → node_modules}/summernote/plugin/hello/summernote-ext-hello.js +9 -10
- data/{vendor/assets/javascripts → node_modules}/summernote/plugin/specialchars/summernote-ext-specialchars.js +22 -25
- data/node_modules/summernote/src/icons/align-center.svg +11 -0
- data/node_modules/summernote/src/icons/align-indent.svg +11 -0
- data/node_modules/summernote/src/icons/align-justify.svg +11 -0
- data/node_modules/summernote/src/icons/align-left.svg +12 -0
- data/node_modules/summernote/src/icons/align-outdent.svg +11 -0
- data/node_modules/summernote/src/icons/align-right.svg +11 -0
- data/node_modules/summernote/src/icons/align.svg +8 -0
- data/node_modules/summernote/src/icons/arrow-circle-down.svg +1 -0
- data/node_modules/summernote/src/icons/arrow-circle-left.svg +1 -0
- data/node_modules/summernote/src/icons/arrow-circle-right.svg +1 -0
- data/node_modules/summernote/src/icons/arrow-circle-up.svg +1 -0
- data/node_modules/summernote/src/icons/arrows-alt.svg +11 -0
- data/node_modules/summernote/src/icons/arrows-h.svg +1 -0
- data/node_modules/summernote/src/icons/arrows-v.svg +1 -0
- data/node_modules/summernote/src/icons/bold.svg +11 -0
- data/node_modules/summernote/src/icons/caret.svg +9 -0
- data/node_modules/summernote/src/icons/chain-broken.svg +47 -0
- data/node_modules/summernote/src/icons/circle.svg +10 -0
- data/node_modules/summernote/src/icons/close.svg +16 -0
- data/node_modules/summernote/src/icons/code.svg +11 -0
- data/node_modules/summernote/src/icons/col-after.svg +96 -0
- data/node_modules/summernote/src/icons/col-before.svg +19 -0
- data/node_modules/summernote/src/icons/col-remove.svg +19 -0
- data/node_modules/summernote/src/icons/dist/font/summernote.eot +0 -0
- data/node_modules/summernote/src/icons/dist/font/summernote.ttf +0 -0
- data/node_modules/summernote/src/icons/dist/font/summernote.woff +0 -0
- data/node_modules/summernote/src/icons/dist/summernote.html +536 -0
- data/node_modules/summernote/src/icons/dist/summernote.less +511 -0
- data/node_modules/summernote/src/icons/eraser.svg +13 -0
- data/node_modules/summernote/src/icons/font.svg +11 -0
- data/node_modules/summernote/src/icons/frame.svg +10 -0
- data/node_modules/summernote/src/icons/italic.svg +11 -0
- data/node_modules/summernote/src/icons/link.svg +21 -0
- data/node_modules/summernote/src/icons/magic.svg +10 -0
- data/node_modules/summernote/src/icons/menu-check.svg +8 -0
- data/node_modules/summernote/src/icons/minus.svg +11 -0
- data/node_modules/summernote/src/icons/orderedlist.svg +12 -0
- data/node_modules/summernote/src/icons/pencil.svg +8 -0
- data/node_modules/summernote/src/icons/picture.svg +11 -0
- data/node_modules/summernote/src/icons/question.svg +10 -0
- data/node_modules/summernote/src/icons/redo.svg +10 -0
- data/node_modules/summernote/src/icons/row-above.svg +19 -0
- data/node_modules/summernote/src/icons/row-below.svg +19 -0
- data/node_modules/summernote/src/icons/row-remove.svg +19 -0
- data/node_modules/summernote/src/icons/special-character.svg +10 -0
- data/node_modules/summernote/src/icons/square.svg +10 -0
- data/node_modules/summernote/src/icons/strikethrough.svg +11 -0
- data/node_modules/summernote/src/icons/subscript.svg +11 -0
- data/node_modules/summernote/src/icons/summernote.svg +11 -0
- data/node_modules/summernote/src/icons/superscript.svg +11 -0
- data/node_modules/summernote/src/icons/table.svg +11 -0
- data/node_modules/summernote/src/icons/templates/summernote.css +110 -0
- data/node_modules/summernote/src/icons/templates/summernote.json +5 -0
- data/node_modules/summernote/src/icons/text-height.svg +11 -0
- data/node_modules/summernote/src/icons/trash.svg +17 -0
- data/node_modules/summernote/src/icons/underline.svg +11 -0
- data/node_modules/summernote/src/icons/undo.svg +10 -0
- data/node_modules/summernote/src/icons/unorderedlist.svg +9 -0
- data/node_modules/summernote/src/icons/video.svg +9 -0
- data/node_modules/summernote/src/js/base/Context.js +231 -0
- data/node_modules/summernote/src/js/base/core/async.js +47 -0
- data/node_modules/summernote/src/js/base/core/dom.js +1088 -0
- data/node_modules/summernote/src/js/base/core/env.js +107 -0
- data/node_modules/summernote/src/js/base/core/func.js +162 -0
- data/node_modules/summernote/src/js/base/core/key.js +92 -0
- data/node_modules/summernote/src/js/base/core/lists.js +210 -0
- data/node_modules/summernote/src/js/base/core/range.js +792 -0
- data/node_modules/summernote/src/js/base/editing/Bullet.js +201 -0
- data/node_modules/summernote/src/js/base/editing/History.js +105 -0
- data/node_modules/summernote/src/js/base/editing/Style.js +158 -0
- data/node_modules/summernote/src/js/base/editing/Table.js +574 -0
- data/node_modules/summernote/src/js/base/editing/Typing.js +90 -0
- data/node_modules/summernote/src/js/base/module/AirPopover.js +73 -0
- data/node_modules/summernote/src/js/base/module/AutoLink.js +61 -0
- data/node_modules/summernote/src/js/base/module/AutoSync.js +19 -0
- data/node_modules/summernote/src/js/base/module/Buttons.js +813 -0
- data/node_modules/summernote/src/js/base/module/Clipboard.js +28 -0
- data/node_modules/summernote/src/js/base/module/Codeview.js +123 -0
- data/node_modules/summernote/src/js/base/module/Dropzone.js +115 -0
- data/node_modules/summernote/src/js/base/module/Editor.js +861 -0
- data/node_modules/summernote/src/js/base/module/Fullscreen.js +51 -0
- data/node_modules/summernote/src/js/base/module/Handle.js +143 -0
- data/node_modules/summernote/src/js/base/module/HelpDialog.js +79 -0
- data/node_modules/summernote/src/js/base/module/HintPopover.js +226 -0
- data/node_modules/summernote/src/js/base/module/ImageDialog.js +131 -0
- data/node_modules/summernote/src/js/base/module/ImagePopover.js +58 -0
- data/node_modules/summernote/src/js/base/module/LinkDialog.js +174 -0
- data/node_modules/summernote/src/js/base/module/LinkPopover.js +69 -0
- data/node_modules/summernote/src/js/base/module/Placeholder.js +39 -0
- data/node_modules/summernote/src/js/base/module/Statusbar.js +42 -0
- data/node_modules/summernote/src/js/base/module/TablePopover.js +71 -0
- data/node_modules/summernote/src/js/base/module/Toolbar.js +136 -0
- data/node_modules/summernote/src/js/base/module/VideoDialog.js +205 -0
- data/node_modules/summernote/src/js/base/renderer.js +66 -0
- data/node_modules/summernote/src/js/base/summernote-en-US.js +159 -0
- data/node_modules/summernote/src/js/bs3/settings.js +297 -0
- data/node_modules/summernote/src/js/bs3/ui.js +237 -0
- data/node_modules/summernote/src/js/bs4/settings.js +301 -0
- data/node_modules/summernote/src/js/bs4/ui.js +242 -0
- data/node_modules/summernote/src/js/lite/settings.js +296 -0
- data/node_modules/summernote/src/js/lite/ui.js +618 -0
- data/node_modules/summernote/src/js/lite/ui/DropdownUI.js +65 -0
- data/node_modules/summernote/src/js/lite/ui/ModalUI.js +34 -0
- data/node_modules/summernote/src/js/lite/ui/PopoverUI.js +94 -0
- data/node_modules/summernote/src/js/lite/ui/TooltipUI.js +93 -0
- data/node_modules/summernote/src/js/summernote.js +46 -0
- data/node_modules/summernote/src/less/elements.less +149 -0
- data/node_modules/summernote/src/less/elements.scss +149 -0
- data/node_modules/summernote/src/less/lite-ui/all.less +15 -0
- data/node_modules/summernote/src/less/lite-ui/btn-group.less +51 -0
- data/node_modules/summernote/src/less/lite-ui/buttons.less +102 -0
- data/node_modules/summernote/src/less/lite-ui/common.less +20 -0
- data/node_modules/summernote/src/less/lite-ui/dropdown.less +39 -0
- data/node_modules/summernote/src/less/lite-ui/form.less +43 -0
- data/node_modules/summernote/src/less/lite-ui/mixins.less +1 -0
- data/node_modules/summernote/src/less/lite-ui/mixins/buttons.less +40 -0
- data/node_modules/summernote/src/less/lite-ui/modal.less +104 -0
- data/node_modules/summernote/src/less/lite-ui/popover.less +121 -0
- data/node_modules/summernote/src/less/lite-ui/toolbar.less +4 -0
- data/node_modules/summernote/src/less/lite-ui/tooltip.less +66 -0
- data/node_modules/summernote/src/less/lite-ui/variables.less +81 -0
- data/node_modules/summernote/src/less/summernote-bs4.less +577 -0
- data/node_modules/summernote/src/less/summernote-bs4.scss +560 -0
- data/node_modules/summernote/src/less/summernote-lite.less +601 -0
- data/node_modules/summernote/src/less/summernote.less +576 -0
- data/node_modules/summernote/src/less/summernote.scss +560 -0
- data/node_modules/summernote/tsconfig.json +12 -0
- metadata +459 -69
- data/vendor/assets/fonts/summernote.eot +0 -0
- data/vendor/assets/fonts/summernote.ttf +0 -0
- data/vendor/assets/fonts/summernote.woff +0 -0
- data/vendor/assets/javascripts/summernote/index.js +0 -1
- data/vendor/assets/javascripts/summernote/locales/index.js +0 -1
- data/vendor/assets/javascripts/summernote/locales/ro-RO.js +0 -102
- data/vendor/assets/javascripts/summernote/locales/th-TH.js +0 -106
- data/vendor/assets/javascripts/summernote/summernote-bs4.js +0 -7990
- data/vendor/assets/javascripts/summernote/summernote-lite.js +0 -8598
- data/vendor/assets/javascripts/summernote/summernote.js +0 -7987
- data/vendor/assets/stylesheets/summernote-bs4.css +0 -1
- data/vendor/assets/stylesheets/summernote-lite.css +0 -1
- data/vendor/assets/stylesheets/summernote.scss +0 -1
@@ -0,0 +1,28 @@
|
|
1
|
+
import lists from '../core/lists';
|
2
|
+
|
3
|
+
export default class Clipboard {
|
4
|
+
constructor(context) {
|
5
|
+
this.context = context;
|
6
|
+
this.$editable = context.layoutInfo.editable;
|
7
|
+
}
|
8
|
+
|
9
|
+
initialize() {
|
10
|
+
this.$editable.on('paste', this.pasteByEvent.bind(this));
|
11
|
+
}
|
12
|
+
|
13
|
+
/**
|
14
|
+
* paste by clipboard event
|
15
|
+
*
|
16
|
+
* @param {Event} event
|
17
|
+
*/
|
18
|
+
pasteByEvent(event) {
|
19
|
+
const clipboardData = event.originalEvent.clipboardData;
|
20
|
+
if (clipboardData && clipboardData.items && clipboardData.items.length) {
|
21
|
+
const item = lists.head(clipboardData.items);
|
22
|
+
if (item.kind === 'file' && item.type.indexOf('image/') !== -1) {
|
23
|
+
this.context.invoke('editor.insertImagesOrCallback', [item.getAsFile()]);
|
24
|
+
}
|
25
|
+
this.context.invoke('editor.afterCommand');
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,123 @@
|
|
1
|
+
import env from '../core/env';
|
2
|
+
import dom from '../core/dom';
|
3
|
+
|
4
|
+
let CodeMirror;
|
5
|
+
if (env.hasCodeMirror) {
|
6
|
+
if (env.isSupportAmd) {
|
7
|
+
require(['codemirror'], function(cm) {
|
8
|
+
CodeMirror = cm;
|
9
|
+
});
|
10
|
+
} else {
|
11
|
+
CodeMirror = window.CodeMirror;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @class Codeview
|
17
|
+
*/
|
18
|
+
export default class CodeView {
|
19
|
+
constructor(context) {
|
20
|
+
this.context = context;
|
21
|
+
this.$editor = context.layoutInfo.editor;
|
22
|
+
this.$editable = context.layoutInfo.editable;
|
23
|
+
this.$codable = context.layoutInfo.codable;
|
24
|
+
this.options = context.options;
|
25
|
+
}
|
26
|
+
|
27
|
+
sync() {
|
28
|
+
const isCodeview = this.isActivated();
|
29
|
+
if (isCodeview && env.hasCodeMirror) {
|
30
|
+
this.$codable.data('cmEditor').save();
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
/**
|
35
|
+
* @return {Boolean}
|
36
|
+
*/
|
37
|
+
isActivated() {
|
38
|
+
return this.$editor.hasClass('codeview');
|
39
|
+
}
|
40
|
+
|
41
|
+
/**
|
42
|
+
* toggle codeview
|
43
|
+
*/
|
44
|
+
toggle() {
|
45
|
+
if (this.isActivated()) {
|
46
|
+
this.deactivate();
|
47
|
+
} else {
|
48
|
+
this.activate();
|
49
|
+
}
|
50
|
+
this.context.triggerEvent('codeview.toggled');
|
51
|
+
}
|
52
|
+
|
53
|
+
/**
|
54
|
+
* activate code view
|
55
|
+
*/
|
56
|
+
activate() {
|
57
|
+
this.$codable.val(dom.html(this.$editable, this.options.prettifyHtml));
|
58
|
+
this.$codable.height(this.$editable.height());
|
59
|
+
|
60
|
+
this.context.invoke('toolbar.updateCodeview', true);
|
61
|
+
this.$editor.addClass('codeview');
|
62
|
+
this.$codable.focus();
|
63
|
+
|
64
|
+
// activate CodeMirror as codable
|
65
|
+
if (env.hasCodeMirror) {
|
66
|
+
const cmEditor = CodeMirror.fromTextArea(this.$codable[0], this.options.codemirror);
|
67
|
+
|
68
|
+
// CodeMirror TernServer
|
69
|
+
if (this.options.codemirror.tern) {
|
70
|
+
const server = new CodeMirror.TernServer(this.options.codemirror.tern);
|
71
|
+
cmEditor.ternServer = server;
|
72
|
+
cmEditor.on('cursorActivity', (cm) => {
|
73
|
+
server.updateArgHints(cm);
|
74
|
+
});
|
75
|
+
}
|
76
|
+
|
77
|
+
cmEditor.on('blur', (event) => {
|
78
|
+
this.context.triggerEvent('blur.codeview', cmEditor.getValue(), event);
|
79
|
+
});
|
80
|
+
|
81
|
+
// CodeMirror hasn't Padding.
|
82
|
+
cmEditor.setSize(null, this.$editable.outerHeight());
|
83
|
+
this.$codable.data('cmEditor', cmEditor);
|
84
|
+
} else {
|
85
|
+
this.$codable.on('blur', (event) => {
|
86
|
+
this.context.triggerEvent('blur.codeview', this.$codable.val(), event);
|
87
|
+
});
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* deactivate code view
|
93
|
+
*/
|
94
|
+
deactivate() {
|
95
|
+
// deactivate CodeMirror as codable
|
96
|
+
if (env.hasCodeMirror) {
|
97
|
+
const cmEditor = this.$codable.data('cmEditor');
|
98
|
+
this.$codable.val(cmEditor.getValue());
|
99
|
+
cmEditor.toTextArea();
|
100
|
+
}
|
101
|
+
|
102
|
+
const value = dom.value(this.$codable, this.options.prettifyHtml) || dom.emptyPara;
|
103
|
+
const isChange = this.$editable.html() !== value;
|
104
|
+
|
105
|
+
this.$editable.html(value);
|
106
|
+
this.$editable.height(this.options.height ? this.$codable.height() : 'auto');
|
107
|
+
this.$editor.removeClass('codeview');
|
108
|
+
|
109
|
+
if (isChange) {
|
110
|
+
this.context.triggerEvent('change', this.$editable.html(), this.$editable);
|
111
|
+
}
|
112
|
+
|
113
|
+
this.$editable.focus();
|
114
|
+
|
115
|
+
this.context.invoke('toolbar.updateCodeview', false);
|
116
|
+
}
|
117
|
+
|
118
|
+
destroy() {
|
119
|
+
if (this.isActivated()) {
|
120
|
+
this.deactivate();
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
@@ -0,0 +1,115 @@
|
|
1
|
+
import $ from 'jquery';
|
2
|
+
|
3
|
+
export default class Dropzone {
|
4
|
+
constructor(context) {
|
5
|
+
this.context = context;
|
6
|
+
this.$eventListener = $(document);
|
7
|
+
this.$editor = context.layoutInfo.editor;
|
8
|
+
this.$editable = context.layoutInfo.editable;
|
9
|
+
this.options = context.options;
|
10
|
+
this.lang = this.options.langInfo;
|
11
|
+
this.documentEventHandlers = {};
|
12
|
+
|
13
|
+
this.$dropzone = $([
|
14
|
+
'<div class="note-dropzone">',
|
15
|
+
' <div class="note-dropzone-message"/>',
|
16
|
+
'</div>'
|
17
|
+
].join('')).prependTo(this.$editor);
|
18
|
+
}
|
19
|
+
|
20
|
+
/**
|
21
|
+
* attach Drag and Drop Events
|
22
|
+
*/
|
23
|
+
initialize() {
|
24
|
+
if (this.options.disableDragAndDrop) {
|
25
|
+
// prevent default drop event
|
26
|
+
this.documentEventHandlers.onDrop = (e) => {
|
27
|
+
e.preventDefault();
|
28
|
+
};
|
29
|
+
// do not consider outside of dropzone
|
30
|
+
this.$eventListener = this.$dropzone;
|
31
|
+
this.$eventListener.on('drop', this.documentEventHandlers.onDrop);
|
32
|
+
} else {
|
33
|
+
this.attachDragAndDropEvent();
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* attach Drag and Drop Events
|
39
|
+
*/
|
40
|
+
attachDragAndDropEvent() {
|
41
|
+
let collection = $();
|
42
|
+
const $dropzoneMessage = this.$dropzone.find('.note-dropzone-message');
|
43
|
+
|
44
|
+
this.documentEventHandlers.onDragenter = (e) => {
|
45
|
+
const isCodeview = this.context.invoke('codeview.isActivated');
|
46
|
+
const hasEditorSize = this.$editor.width() > 0 && this.$editor.height() > 0;
|
47
|
+
if (!isCodeview && !collection.length && hasEditorSize) {
|
48
|
+
this.$editor.addClass('dragover');
|
49
|
+
this.$dropzone.width(this.$editor.width());
|
50
|
+
this.$dropzone.height(this.$editor.height());
|
51
|
+
$dropzoneMessage.text(this.lang.image.dragImageHere);
|
52
|
+
}
|
53
|
+
collection = collection.add(e.target);
|
54
|
+
};
|
55
|
+
|
56
|
+
this.documentEventHandlers.onDragleave = (e) => {
|
57
|
+
collection = collection.not(e.target);
|
58
|
+
if (!collection.length) {
|
59
|
+
this.$editor.removeClass('dragover');
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
63
|
+
this.documentEventHandlers.onDrop = () => {
|
64
|
+
collection = $();
|
65
|
+
this.$editor.removeClass('dragover');
|
66
|
+
};
|
67
|
+
|
68
|
+
// show dropzone on dragenter when dragging a object to document
|
69
|
+
// -but only if the editor is visible, i.e. has a positive width and height
|
70
|
+
this.$eventListener.on('dragenter', this.documentEventHandlers.onDragenter)
|
71
|
+
.on('dragleave', this.documentEventHandlers.onDragleave)
|
72
|
+
.on('drop', this.documentEventHandlers.onDrop);
|
73
|
+
|
74
|
+
// change dropzone's message on hover.
|
75
|
+
this.$dropzone.on('dragenter', () => {
|
76
|
+
this.$dropzone.addClass('hover');
|
77
|
+
$dropzoneMessage.text(this.lang.image.dropImage);
|
78
|
+
}).on('dragleave', () => {
|
79
|
+
this.$dropzone.removeClass('hover');
|
80
|
+
$dropzoneMessage.text(this.lang.image.dragImageHere);
|
81
|
+
});
|
82
|
+
|
83
|
+
// attach dropImage
|
84
|
+
this.$dropzone.on('drop', (event) => {
|
85
|
+
const dataTransfer = event.originalEvent.dataTransfer;
|
86
|
+
|
87
|
+
// stop the browser from opening the dropped content
|
88
|
+
event.preventDefault();
|
89
|
+
|
90
|
+
if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
|
91
|
+
this.$editable.focus();
|
92
|
+
this.context.invoke('editor.insertImagesOrCallback', dataTransfer.files);
|
93
|
+
} else {
|
94
|
+
$.each(dataTransfer.types, (idx, type) => {
|
95
|
+
const content = dataTransfer.getData(type);
|
96
|
+
|
97
|
+
if (type.toLowerCase().indexOf('text') > -1) {
|
98
|
+
this.context.invoke('editor.pasteHTML', content);
|
99
|
+
} else {
|
100
|
+
$(content).each((idx, item) => {
|
101
|
+
this.context.invoke('editor.insertNode', item);
|
102
|
+
});
|
103
|
+
}
|
104
|
+
});
|
105
|
+
}
|
106
|
+
}).on('dragover', false); // prevent default dragover event
|
107
|
+
}
|
108
|
+
|
109
|
+
destroy() {
|
110
|
+
Object.keys(this.documentEventHandlers).forEach((key) => {
|
111
|
+
this.$eventListener.off(key.substr(2).toLowerCase(), this.documentEventHandlers[key]);
|
112
|
+
});
|
113
|
+
this.documentEventHandlers = {};
|
114
|
+
}
|
115
|
+
}
|
@@ -0,0 +1,861 @@
|
|
1
|
+
import $ from 'jquery';
|
2
|
+
import env from '../core/env';
|
3
|
+
import key from '../core/key';
|
4
|
+
import func from '../core/func';
|
5
|
+
import lists from '../core/lists';
|
6
|
+
import dom from '../core/dom';
|
7
|
+
import range from '../core/range';
|
8
|
+
import { readFileAsDataURL, createImage } from '../core/async';
|
9
|
+
import History from '../editing/History';
|
10
|
+
import Style from '../editing/Style';
|
11
|
+
import Typing from '../editing/Typing';
|
12
|
+
import Table from '../editing/Table';
|
13
|
+
import Bullet from '../editing/Bullet';
|
14
|
+
|
15
|
+
const KEY_BOGUS = 'bogus';
|
16
|
+
|
17
|
+
/**
|
18
|
+
* @class Editor
|
19
|
+
*/
|
20
|
+
export default class Editor {
|
21
|
+
constructor(context) {
|
22
|
+
this.context = context;
|
23
|
+
|
24
|
+
this.$note = context.layoutInfo.note;
|
25
|
+
this.$editor = context.layoutInfo.editor;
|
26
|
+
this.$editable = context.layoutInfo.editable;
|
27
|
+
this.options = context.options;
|
28
|
+
this.lang = this.options.langInfo;
|
29
|
+
|
30
|
+
this.editable = this.$editable[0];
|
31
|
+
this.lastRange = null;
|
32
|
+
|
33
|
+
this.style = new Style();
|
34
|
+
this.table = new Table();
|
35
|
+
this.typing = new Typing();
|
36
|
+
this.bullet = new Bullet();
|
37
|
+
this.history = new History(this.$editable);
|
38
|
+
|
39
|
+
this.context.memo('help.undo', this.lang.help.undo);
|
40
|
+
this.context.memo('help.redo', this.lang.help.redo);
|
41
|
+
this.context.memo('help.tab', this.lang.help.tab);
|
42
|
+
this.context.memo('help.untab', this.lang.help.untab);
|
43
|
+
this.context.memo('help.insertParagraph', this.lang.help.insertParagraph);
|
44
|
+
this.context.memo('help.insertOrderedList', this.lang.help.insertOrderedList);
|
45
|
+
this.context.memo('help.insertUnorderedList', this.lang.help.insertUnorderedList);
|
46
|
+
this.context.memo('help.indent', this.lang.help.indent);
|
47
|
+
this.context.memo('help.outdent', this.lang.help.outdent);
|
48
|
+
this.context.memo('help.formatPara', this.lang.help.formatPara);
|
49
|
+
this.context.memo('help.insertHorizontalRule', this.lang.help.insertHorizontalRule);
|
50
|
+
this.context.memo('help.fontName', this.lang.help.fontName);
|
51
|
+
|
52
|
+
// native commands(with execCommand), generate function for execCommand
|
53
|
+
const commands = [
|
54
|
+
'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript',
|
55
|
+
'justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull',
|
56
|
+
'formatBlock', 'removeFormat', 'backColor'
|
57
|
+
];
|
58
|
+
|
59
|
+
for (let idx = 0, len = commands.length; idx < len; idx++) {
|
60
|
+
this[commands[idx]] = ((sCmd) => {
|
61
|
+
return (value) => {
|
62
|
+
this.beforeCommand();
|
63
|
+
document.execCommand(sCmd, false, value);
|
64
|
+
this.afterCommand(true);
|
65
|
+
};
|
66
|
+
})(commands[idx]);
|
67
|
+
this.context.memo('help.' + commands[idx], this.lang.help[commands[idx]]);
|
68
|
+
}
|
69
|
+
|
70
|
+
this.fontName = this.wrapCommand((value) => {
|
71
|
+
return this.fontStyling('font-family', "\'" + value + "\'");
|
72
|
+
});
|
73
|
+
|
74
|
+
this.fontSize = this.wrapCommand((value) => {
|
75
|
+
return this.fontStyling('font-size', value + 'px');
|
76
|
+
});
|
77
|
+
|
78
|
+
for (let idx = 1; idx <= 6; idx++) {
|
79
|
+
this['formatH' + idx] = ((idx) => {
|
80
|
+
return () => {
|
81
|
+
this.formatBlock('H' + idx);
|
82
|
+
};
|
83
|
+
})(idx);
|
84
|
+
this.context.memo('help.formatH' + idx, this.lang.help['formatH' + idx]);
|
85
|
+
};
|
86
|
+
|
87
|
+
this.insertParagraph = this.wrapCommand(() => {
|
88
|
+
this.typing.insertParagraph(this.editable);
|
89
|
+
});
|
90
|
+
|
91
|
+
this.insertOrderedList = this.wrapCommand(() => {
|
92
|
+
this.bullet.insertOrderedList(this.editable);
|
93
|
+
});
|
94
|
+
|
95
|
+
this.insertUnorderedList = this.wrapCommand(() => {
|
96
|
+
this.bullet.insertUnorderedList(this.editable);
|
97
|
+
});
|
98
|
+
|
99
|
+
this.indent = this.wrapCommand(() => {
|
100
|
+
this.bullet.indent(this.editable);
|
101
|
+
});
|
102
|
+
|
103
|
+
this.outdent = this.wrapCommand(() => {
|
104
|
+
this.bullet.outdent(this.editable);
|
105
|
+
});
|
106
|
+
|
107
|
+
/**
|
108
|
+
* insertNode
|
109
|
+
* insert node
|
110
|
+
* @param {Node} node
|
111
|
+
*/
|
112
|
+
this.insertNode = this.wrapCommand((node) => {
|
113
|
+
if (this.isLimited($(node).text().length)) {
|
114
|
+
return;
|
115
|
+
}
|
116
|
+
const rng = this.createRange();
|
117
|
+
rng.insertNode(node);
|
118
|
+
range.createFromNodeAfter(node).select();
|
119
|
+
});
|
120
|
+
|
121
|
+
/**
|
122
|
+
* insert text
|
123
|
+
* @param {String} text
|
124
|
+
*/
|
125
|
+
this.insertText = this.wrapCommand((text) => {
|
126
|
+
if (this.isLimited(text.length)) {
|
127
|
+
return;
|
128
|
+
}
|
129
|
+
const rng = this.createRange();
|
130
|
+
const textNode = rng.insertNode(dom.createText(text));
|
131
|
+
range.create(textNode, dom.nodeLength(textNode)).select();
|
132
|
+
});
|
133
|
+
/**
|
134
|
+
* paste HTML
|
135
|
+
* @param {String} markup
|
136
|
+
*/
|
137
|
+
this.pasteHTML = this.wrapCommand((markup) => {
|
138
|
+
if (this.isLimited(markup.length)) {
|
139
|
+
return;
|
140
|
+
}
|
141
|
+
const contents = this.createRange().pasteHTML(markup);
|
142
|
+
range.createFromNodeAfter(lists.last(contents)).select();
|
143
|
+
});
|
144
|
+
|
145
|
+
/**
|
146
|
+
* formatBlock
|
147
|
+
*
|
148
|
+
* @param {String} tagName
|
149
|
+
*/
|
150
|
+
this.formatBlock = this.wrapCommand((tagName, $target) => {
|
151
|
+
const onApplyCustomStyle = this.options.callbacks.onApplyCustomStyle;
|
152
|
+
if (onApplyCustomStyle) {
|
153
|
+
onApplyCustomStyle.call(this, $target, this.context, this.onFormatBlock);
|
154
|
+
} else {
|
155
|
+
this.onFormatBlock(tagName, $target);
|
156
|
+
}
|
157
|
+
});
|
158
|
+
|
159
|
+
/**
|
160
|
+
* insert horizontal rule
|
161
|
+
*/
|
162
|
+
this.insertHorizontalRule = this.wrapCommand(() => {
|
163
|
+
const hrNode = this.createRange().insertNode(dom.create('HR'));
|
164
|
+
if (hrNode.nextSibling) {
|
165
|
+
range.create(hrNode.nextSibling, 0).normalize().select();
|
166
|
+
}
|
167
|
+
});
|
168
|
+
|
169
|
+
/**
|
170
|
+
* lineHeight
|
171
|
+
* @param {String} value
|
172
|
+
*/
|
173
|
+
this.lineHeight = this.wrapCommand((value) => {
|
174
|
+
this.style.stylePara(this.createRange(), {
|
175
|
+
lineHeight: value
|
176
|
+
});
|
177
|
+
});
|
178
|
+
|
179
|
+
/**
|
180
|
+
* create link (command)
|
181
|
+
*
|
182
|
+
* @param {Object} linkInfo
|
183
|
+
*/
|
184
|
+
this.createLink = this.wrapCommand((linkInfo) => {
|
185
|
+
let linkUrl = linkInfo.url;
|
186
|
+
const linkText = linkInfo.text;
|
187
|
+
const isNewWindow = linkInfo.isNewWindow;
|
188
|
+
let rng = linkInfo.range || this.createRange();
|
189
|
+
const isTextChanged = rng.toString() !== linkText;
|
190
|
+
|
191
|
+
// handle spaced urls from input
|
192
|
+
if (typeof linkUrl === 'string') {
|
193
|
+
linkUrl = linkUrl.trim();
|
194
|
+
}
|
195
|
+
|
196
|
+
if (this.options.onCreateLink) {
|
197
|
+
linkUrl = this.options.onCreateLink(linkUrl);
|
198
|
+
} else {
|
199
|
+
// if url doesn't match an URL schema, set http:// as default
|
200
|
+
linkUrl = /^[A-Za-z][A-Za-z0-9+-.]*\:[\/\/]?/.test(linkUrl)
|
201
|
+
? linkUrl : 'http://' + linkUrl;
|
202
|
+
}
|
203
|
+
|
204
|
+
let anchors = [];
|
205
|
+
if (isTextChanged) {
|
206
|
+
rng = rng.deleteContents();
|
207
|
+
const anchor = rng.insertNode($('<A>' + linkText + '</A>')[0]);
|
208
|
+
anchors.push(anchor);
|
209
|
+
} else {
|
210
|
+
anchors = this.style.styleNodes(rng, {
|
211
|
+
nodeName: 'A',
|
212
|
+
expandClosestSibling: true,
|
213
|
+
onlyPartialContains: true
|
214
|
+
});
|
215
|
+
}
|
216
|
+
|
217
|
+
$.each(anchors, (idx, anchor) => {
|
218
|
+
$(anchor).attr('href', linkUrl);
|
219
|
+
if (isNewWindow) {
|
220
|
+
$(anchor).attr('target', '_blank');
|
221
|
+
} else {
|
222
|
+
$(anchor).removeAttr('target');
|
223
|
+
}
|
224
|
+
});
|
225
|
+
|
226
|
+
const startRange = range.createFromNodeBefore(lists.head(anchors));
|
227
|
+
const startPoint = startRange.getStartPoint();
|
228
|
+
const endRange = range.createFromNodeAfter(lists.last(anchors));
|
229
|
+
const endPoint = endRange.getEndPoint();
|
230
|
+
|
231
|
+
range.create(
|
232
|
+
startPoint.node,
|
233
|
+
startPoint.offset,
|
234
|
+
endPoint.node,
|
235
|
+
endPoint.offset
|
236
|
+
).select();
|
237
|
+
});
|
238
|
+
|
239
|
+
/**
|
240
|
+
* setting color
|
241
|
+
*
|
242
|
+
* @param {Object} sObjColor color code
|
243
|
+
* @param {String} sObjColor.foreColor foreground color
|
244
|
+
* @param {String} sObjColor.backColor background color
|
245
|
+
*/
|
246
|
+
this.color = this.wrapCommand((colorInfo) => {
|
247
|
+
const foreColor = colorInfo.foreColor;
|
248
|
+
const backColor = colorInfo.backColor;
|
249
|
+
|
250
|
+
if (foreColor) { document.execCommand('foreColor', false, foreColor); }
|
251
|
+
if (backColor) { document.execCommand('backColor', false, backColor); }
|
252
|
+
});
|
253
|
+
|
254
|
+
/**
|
255
|
+
* Set foreground color
|
256
|
+
*
|
257
|
+
* @param {String} colorCode foreground color code
|
258
|
+
*/
|
259
|
+
this.foreColor = this.wrapCommand((colorInfo) => {
|
260
|
+
document.execCommand('styleWithCSS', false, true);
|
261
|
+
document.execCommand('foreColor', false, colorInfo);
|
262
|
+
});
|
263
|
+
|
264
|
+
/**
|
265
|
+
* insert Table
|
266
|
+
*
|
267
|
+
* @param {String} dimension of table (ex : "5x5")
|
268
|
+
*/
|
269
|
+
this.insertTable = this.wrapCommand((dim) => {
|
270
|
+
const dimension = dim.split('x');
|
271
|
+
|
272
|
+
const rng = this.createRange().deleteContents();
|
273
|
+
rng.insertNode(this.table.createTable(dimension[0], dimension[1], this.options));
|
274
|
+
});
|
275
|
+
|
276
|
+
/**
|
277
|
+
* remove media object and Figure Elements if media object is img with Figure.
|
278
|
+
*/
|
279
|
+
this.removeMedia = this.wrapCommand(() => {
|
280
|
+
let $target = $(this.restoreTarget()).parent();
|
281
|
+
if ($target.parent('figure').length) {
|
282
|
+
$target.parent('figure').remove();
|
283
|
+
} else {
|
284
|
+
$target = $(this.restoreTarget()).detach();
|
285
|
+
}
|
286
|
+
this.context.triggerEvent('media.delete', $target, this.$editable);
|
287
|
+
});
|
288
|
+
|
289
|
+
/**
|
290
|
+
* float me
|
291
|
+
*
|
292
|
+
* @param {String} value
|
293
|
+
*/
|
294
|
+
this.floatMe = this.wrapCommand((value) => {
|
295
|
+
const $target = $(this.restoreTarget());
|
296
|
+
$target.toggleClass('note-float-left', value === 'left');
|
297
|
+
$target.toggleClass('note-float-right', value === 'right');
|
298
|
+
$target.css('float', value);
|
299
|
+
});
|
300
|
+
|
301
|
+
/**
|
302
|
+
* resize overlay element
|
303
|
+
* @param {String} value
|
304
|
+
*/
|
305
|
+
this.resize = this.wrapCommand((value) => {
|
306
|
+
const $target = $(this.restoreTarget());
|
307
|
+
$target.css({
|
308
|
+
width: value * 100 + '%',
|
309
|
+
height: ''
|
310
|
+
});
|
311
|
+
});
|
312
|
+
}
|
313
|
+
|
314
|
+
initialize() {
|
315
|
+
// bind custom events
|
316
|
+
this.$editable.on('keydown', (event) => {
|
317
|
+
if (event.keyCode === key.code.ENTER) {
|
318
|
+
this.context.triggerEvent('enter', event);
|
319
|
+
}
|
320
|
+
this.context.triggerEvent('keydown', event);
|
321
|
+
|
322
|
+
if (!event.isDefaultPrevented()) {
|
323
|
+
if (this.options.shortcuts) {
|
324
|
+
this.handleKeyMap(event);
|
325
|
+
} else {
|
326
|
+
this.preventDefaultEditableShortCuts(event);
|
327
|
+
}
|
328
|
+
}
|
329
|
+
if (this.isLimited(1, event)) {
|
330
|
+
return false;
|
331
|
+
}
|
332
|
+
}).on('keyup', (event) => {
|
333
|
+
this.context.triggerEvent('keyup', event);
|
334
|
+
}).on('focus', (event) => {
|
335
|
+
this.context.triggerEvent('focus', event);
|
336
|
+
}).on('blur', (event) => {
|
337
|
+
this.context.triggerEvent('blur', event);
|
338
|
+
}).on('mousedown', (event) => {
|
339
|
+
this.context.triggerEvent('mousedown', event);
|
340
|
+
}).on('mouseup', (event) => {
|
341
|
+
this.context.triggerEvent('mouseup', event);
|
342
|
+
}).on('scroll', (event) => {
|
343
|
+
this.context.triggerEvent('scroll', event);
|
344
|
+
}).on('paste', (event) => {
|
345
|
+
this.context.triggerEvent('paste', event);
|
346
|
+
});
|
347
|
+
|
348
|
+
// init content before set event
|
349
|
+
this.$editable.html(dom.html(this.$note) || dom.emptyPara);
|
350
|
+
|
351
|
+
this.$editable.on(env.inputEventName, func.debounce(() => {
|
352
|
+
this.context.triggerEvent('change', this.$editable.html());
|
353
|
+
}, 100));
|
354
|
+
|
355
|
+
this.$editor.on('focusin', (event) => {
|
356
|
+
this.context.triggerEvent('focusin', event);
|
357
|
+
}).on('focusout', (event) => {
|
358
|
+
this.context.triggerEvent('focusout', event);
|
359
|
+
});
|
360
|
+
|
361
|
+
if (!this.options.airMode) {
|
362
|
+
if (this.options.width) {
|
363
|
+
this.$editor.outerWidth(this.options.width);
|
364
|
+
}
|
365
|
+
if (this.options.height) {
|
366
|
+
this.$editable.outerHeight(this.options.height);
|
367
|
+
}
|
368
|
+
if (this.options.maxHeight) {
|
369
|
+
this.$editable.css('max-height', this.options.maxHeight);
|
370
|
+
}
|
371
|
+
if (this.options.minHeight) {
|
372
|
+
this.$editable.css('min-height', this.options.minHeight);
|
373
|
+
}
|
374
|
+
}
|
375
|
+
|
376
|
+
this.history.recordUndo();
|
377
|
+
}
|
378
|
+
|
379
|
+
destroy() {
|
380
|
+
this.$editable.off();
|
381
|
+
}
|
382
|
+
|
383
|
+
handleKeyMap(event) {
|
384
|
+
const keyMap = this.options.keyMap[env.isMac ? 'mac' : 'pc'];
|
385
|
+
const keys = [];
|
386
|
+
|
387
|
+
if (event.metaKey) { keys.push('CMD'); }
|
388
|
+
if (event.ctrlKey && !event.altKey) { keys.push('CTRL'); }
|
389
|
+
if (event.shiftKey) { keys.push('SHIFT'); }
|
390
|
+
|
391
|
+
const keyName = key.nameFromCode[event.keyCode];
|
392
|
+
if (keyName) {
|
393
|
+
keys.push(keyName);
|
394
|
+
}
|
395
|
+
|
396
|
+
const eventName = keyMap[keys.join('+')];
|
397
|
+
if (eventName) {
|
398
|
+
if (this.context.invoke(eventName) !== false) {
|
399
|
+
event.preventDefault();
|
400
|
+
}
|
401
|
+
} else if (key.isEdit(event.keyCode)) {
|
402
|
+
this.afterCommand();
|
403
|
+
}
|
404
|
+
}
|
405
|
+
|
406
|
+
preventDefaultEditableShortCuts(event) {
|
407
|
+
// B(Bold, 66) / I(Italic, 73) / U(Underline, 85)
|
408
|
+
if ((event.ctrlKey || event.metaKey) &&
|
409
|
+
lists.contains([66, 73, 85], event.keyCode)) {
|
410
|
+
event.preventDefault();
|
411
|
+
}
|
412
|
+
}
|
413
|
+
|
414
|
+
isLimited(pad, event) {
|
415
|
+
pad = pad || 0;
|
416
|
+
|
417
|
+
if (typeof event !== 'undefined') {
|
418
|
+
if (key.isMove(event.keyCode) ||
|
419
|
+
(event.ctrlKey || event.metaKey) ||
|
420
|
+
lists.contains([key.code.BACKSPACE, key.code.DELETE], event.keyCode)) {
|
421
|
+
return false;
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
425
|
+
if (this.options.maxTextLength > 0) {
|
426
|
+
if ((this.$editable.text().length + pad) >= this.options.maxTextLength) {
|
427
|
+
return true;
|
428
|
+
}
|
429
|
+
}
|
430
|
+
return false;
|
431
|
+
}
|
432
|
+
/**
|
433
|
+
* create range
|
434
|
+
* @return {WrappedRange}
|
435
|
+
*/
|
436
|
+
createRange() {
|
437
|
+
this.focus();
|
438
|
+
return range.create(this.editable);
|
439
|
+
}
|
440
|
+
|
441
|
+
/**
|
442
|
+
* saveRange
|
443
|
+
*
|
444
|
+
* save current range
|
445
|
+
*
|
446
|
+
* @param {Boolean} [thenCollapse=false]
|
447
|
+
*/
|
448
|
+
saveRange(thenCollapse) {
|
449
|
+
this.lastRange = this.createRange();
|
450
|
+
if (thenCollapse) {
|
451
|
+
this.lastRange.collapse().select();
|
452
|
+
}
|
453
|
+
}
|
454
|
+
|
455
|
+
/**
|
456
|
+
* restoreRange
|
457
|
+
*
|
458
|
+
* restore lately range
|
459
|
+
*/
|
460
|
+
restoreRange() {
|
461
|
+
if (this.lastRange) {
|
462
|
+
this.lastRange.select();
|
463
|
+
this.focus();
|
464
|
+
}
|
465
|
+
}
|
466
|
+
|
467
|
+
saveTarget(node) {
|
468
|
+
this.$editable.data('target', node);
|
469
|
+
}
|
470
|
+
|
471
|
+
clearTarget() {
|
472
|
+
this.$editable.removeData('target');
|
473
|
+
}
|
474
|
+
|
475
|
+
restoreTarget() {
|
476
|
+
return this.$editable.data('target');
|
477
|
+
}
|
478
|
+
|
479
|
+
/**
|
480
|
+
* currentStyle
|
481
|
+
*
|
482
|
+
* current style
|
483
|
+
* @return {Object|Boolean} unfocus
|
484
|
+
*/
|
485
|
+
currentStyle() {
|
486
|
+
let rng = range.create();
|
487
|
+
if (rng) {
|
488
|
+
rng = rng.normalize();
|
489
|
+
}
|
490
|
+
return rng ? this.style.current(rng) : this.style.fromNode(this.$editable);
|
491
|
+
}
|
492
|
+
|
493
|
+
/**
|
494
|
+
* style from node
|
495
|
+
*
|
496
|
+
* @param {jQuery} $node
|
497
|
+
* @return {Object}
|
498
|
+
*/
|
499
|
+
styleFromNode($node) {
|
500
|
+
return this.style.fromNode($node);
|
501
|
+
}
|
502
|
+
|
503
|
+
/**
|
504
|
+
* undo
|
505
|
+
*/
|
506
|
+
undo() {
|
507
|
+
this.context.triggerEvent('before.command', this.$editable.html());
|
508
|
+
this.history.undo();
|
509
|
+
this.context.triggerEvent('change', this.$editable.html());
|
510
|
+
}
|
511
|
+
|
512
|
+
/**
|
513
|
+
* redo
|
514
|
+
*/
|
515
|
+
redo() {
|
516
|
+
this.context.triggerEvent('before.command', this.$editable.html());
|
517
|
+
this.history.redo();
|
518
|
+
this.context.triggerEvent('change', this.$editable.html());
|
519
|
+
}
|
520
|
+
|
521
|
+
/**
|
522
|
+
* before command
|
523
|
+
*/
|
524
|
+
beforeCommand() {
|
525
|
+
this.context.triggerEvent('before.command', this.$editable.html());
|
526
|
+
// keep focus on editable before command execution
|
527
|
+
this.focus();
|
528
|
+
}
|
529
|
+
|
530
|
+
/**
|
531
|
+
* after command
|
532
|
+
* @param {Boolean} isPreventTrigger
|
533
|
+
*/
|
534
|
+
afterCommand(isPreventTrigger) {
|
535
|
+
this.normalizeContent();
|
536
|
+
this.history.recordUndo();
|
537
|
+
if (!isPreventTrigger) {
|
538
|
+
this.context.triggerEvent('change', this.$editable.html());
|
539
|
+
}
|
540
|
+
}
|
541
|
+
|
542
|
+
/**
|
543
|
+
* handle tab key
|
544
|
+
*/
|
545
|
+
tab() {
|
546
|
+
const rng = this.createRange();
|
547
|
+
if (rng.isCollapsed() && rng.isOnCell()) {
|
548
|
+
this.table.tab(rng);
|
549
|
+
} else {
|
550
|
+
if (this.options.tabSize === 0) {
|
551
|
+
return false;
|
552
|
+
}
|
553
|
+
|
554
|
+
if (!this.isLimited(this.options.tabSize)) {
|
555
|
+
this.beforeCommand();
|
556
|
+
this.typing.insertTab(rng, this.options.tabSize);
|
557
|
+
this.afterCommand();
|
558
|
+
}
|
559
|
+
}
|
560
|
+
}
|
561
|
+
|
562
|
+
/**
|
563
|
+
* handle shift+tab key
|
564
|
+
*/
|
565
|
+
untab() {
|
566
|
+
const rng = this.createRange();
|
567
|
+
if (rng.isCollapsed() && rng.isOnCell()) {
|
568
|
+
this.table.tab(rng, true);
|
569
|
+
} else {
|
570
|
+
if (this.options.tabSize === 0) {
|
571
|
+
return false;
|
572
|
+
}
|
573
|
+
}
|
574
|
+
}
|
575
|
+
|
576
|
+
/**
|
577
|
+
* run given function between beforeCommand and afterCommand
|
578
|
+
*/
|
579
|
+
wrapCommand(fn) {
|
580
|
+
return () => {
|
581
|
+
this.beforeCommand();
|
582
|
+
fn.apply(this, arguments);
|
583
|
+
this.afterCommand();
|
584
|
+
};
|
585
|
+
}
|
586
|
+
|
587
|
+
/**
|
588
|
+
* insert image
|
589
|
+
*
|
590
|
+
* @param {String} src
|
591
|
+
* @param {String|Function} param
|
592
|
+
* @return {Promise}
|
593
|
+
*/
|
594
|
+
insertImage(src, param) {
|
595
|
+
return createImage(src, param).then(($image) => {
|
596
|
+
this.beforeCommand();
|
597
|
+
|
598
|
+
if (typeof param === 'function') {
|
599
|
+
param($image);
|
600
|
+
} else {
|
601
|
+
if (typeof param === 'string') {
|
602
|
+
$image.attr('data-filename', param);
|
603
|
+
}
|
604
|
+
$image.css('width', Math.min(this.$editable.width(), $image.width()));
|
605
|
+
}
|
606
|
+
|
607
|
+
$image.show();
|
608
|
+
range.create(this.editable).insertNode($image[0]);
|
609
|
+
range.createFromNodeAfter($image[0]).select();
|
610
|
+
this.afterCommand();
|
611
|
+
}).fail((e) => {
|
612
|
+
this.context.triggerEvent('image.upload.error', e);
|
613
|
+
});
|
614
|
+
}
|
615
|
+
|
616
|
+
/**
|
617
|
+
* insertImages
|
618
|
+
* @param {File[]} files
|
619
|
+
*/
|
620
|
+
insertImages(files) {
|
621
|
+
$.each(files, (idx, file) => {
|
622
|
+
const filename = file.name;
|
623
|
+
if (this.options.maximumImageFileSize && this.options.maximumImageFileSize < file.size) {
|
624
|
+
this.context.triggerEvent('image.upload.error', this.lang.image.maximumFileSizeError);
|
625
|
+
} else {
|
626
|
+
readFileAsDataURL(file).then((dataURL) => {
|
627
|
+
return this.insertImage(dataURL, filename);
|
628
|
+
}).fail(() => {
|
629
|
+
this.context.triggerEvent('image.upload.error');
|
630
|
+
});
|
631
|
+
}
|
632
|
+
});
|
633
|
+
}
|
634
|
+
|
635
|
+
/**
|
636
|
+
* insertImagesOrCallback
|
637
|
+
* @param {File[]} files
|
638
|
+
*/
|
639
|
+
insertImagesOrCallback(files) {
|
640
|
+
const callbacks = this.options.callbacks;
|
641
|
+
|
642
|
+
// If onImageUpload this.options setted
|
643
|
+
if (callbacks.onImageUpload) {
|
644
|
+
this.context.triggerEvent('image.upload', files);
|
645
|
+
// else insert Image as dataURL
|
646
|
+
} else {
|
647
|
+
this.insertImages(files);
|
648
|
+
}
|
649
|
+
}
|
650
|
+
|
651
|
+
/**
|
652
|
+
* return selected plain text
|
653
|
+
* @return {String} text
|
654
|
+
*/
|
655
|
+
getSelectedText() {
|
656
|
+
let rng = this.createRange();
|
657
|
+
|
658
|
+
// if range on anchor, expand range with anchor
|
659
|
+
if (rng.isOnAnchor()) {
|
660
|
+
rng = range.createFromNode(dom.ancestor(rng.sc, dom.isAnchor));
|
661
|
+
}
|
662
|
+
|
663
|
+
return rng.toString();
|
664
|
+
}
|
665
|
+
|
666
|
+
onFormatBlock(tagName, $target) {
|
667
|
+
// [workaround] for MSIE, IE need `<`
|
668
|
+
tagName = env.isMSIE ? '<' + tagName + '>' : tagName;
|
669
|
+
document.execCommand('FormatBlock', false, tagName);
|
670
|
+
|
671
|
+
// support custom class
|
672
|
+
if ($target && $target.length) {
|
673
|
+
const className = $target[0].className || '';
|
674
|
+
if (className) {
|
675
|
+
const currentRange = this.createRange();
|
676
|
+
|
677
|
+
const $parent = $([currentRange.sc, currentRange.ec]).closest(tagName);
|
678
|
+
$parent.addClass(className);
|
679
|
+
}
|
680
|
+
}
|
681
|
+
}
|
682
|
+
|
683
|
+
formatPara() {
|
684
|
+
this.formatBlock('P');
|
685
|
+
}
|
686
|
+
|
687
|
+
fontStyling(target, value) {
|
688
|
+
const rng = this.createRange();
|
689
|
+
|
690
|
+
if (rng) {
|
691
|
+
const spans = this.style.styleNodes(rng);
|
692
|
+
$(spans).css(target, value);
|
693
|
+
|
694
|
+
// [workaround] added styled bogus span for style
|
695
|
+
// - also bogus character needed for cursor position
|
696
|
+
if (rng.isCollapsed()) {
|
697
|
+
const firstSpan = lists.head(spans);
|
698
|
+
if (firstSpan && !dom.nodeLength(firstSpan)) {
|
699
|
+
firstSpan.innerHTML = dom.ZERO_WIDTH_NBSP_CHAR;
|
700
|
+
range.createFromNodeAfter(firstSpan.firstChild).select();
|
701
|
+
this.$editable.data(KEY_BOGUS, firstSpan);
|
702
|
+
}
|
703
|
+
}
|
704
|
+
}
|
705
|
+
}
|
706
|
+
|
707
|
+
/**
|
708
|
+
* unlink
|
709
|
+
*
|
710
|
+
* @type command
|
711
|
+
*/
|
712
|
+
unlink() {
|
713
|
+
let rng = this.createRange();
|
714
|
+
if (rng.isOnAnchor()) {
|
715
|
+
const anchor = dom.ancestor(rng.sc, dom.isAnchor);
|
716
|
+
rng = range.createFromNode(anchor);
|
717
|
+
rng.select();
|
718
|
+
|
719
|
+
this.beforeCommand();
|
720
|
+
document.execCommand('unlink');
|
721
|
+
this.afterCommand();
|
722
|
+
}
|
723
|
+
}
|
724
|
+
|
725
|
+
/**
|
726
|
+
* returns link info
|
727
|
+
*
|
728
|
+
* @return {Object}
|
729
|
+
* @return {WrappedRange} return.range
|
730
|
+
* @return {String} return.text
|
731
|
+
* @return {Boolean} [return.isNewWindow=true]
|
732
|
+
* @return {String} [return.url=""]
|
733
|
+
*/
|
734
|
+
getLinkInfo() {
|
735
|
+
const rng = this.createRange().expand(dom.isAnchor);
|
736
|
+
|
737
|
+
// Get the first anchor on range(for edit).
|
738
|
+
const $anchor = $(lists.head(rng.nodes(dom.isAnchor)));
|
739
|
+
const linkInfo = {
|
740
|
+
range: rng,
|
741
|
+
text: rng.toString(),
|
742
|
+
url: $anchor.length ? $anchor.attr('href') : ''
|
743
|
+
};
|
744
|
+
|
745
|
+
// Define isNewWindow when anchor exists.
|
746
|
+
if ($anchor.length) {
|
747
|
+
linkInfo.isNewWindow = $anchor.attr('target') === '_blank';
|
748
|
+
}
|
749
|
+
|
750
|
+
return linkInfo;
|
751
|
+
}
|
752
|
+
|
753
|
+
addRow(position) {
|
754
|
+
const rng = this.createRange(this.$editable);
|
755
|
+
if (rng.isCollapsed() && rng.isOnCell()) {
|
756
|
+
this.beforeCommand();
|
757
|
+
this.table.addRow(rng, position);
|
758
|
+
this.afterCommand();
|
759
|
+
}
|
760
|
+
}
|
761
|
+
|
762
|
+
addCol(position) {
|
763
|
+
const rng = this.createRange(this.$editable);
|
764
|
+
if (rng.isCollapsed() && rng.isOnCell()) {
|
765
|
+
this.beforeCommand();
|
766
|
+
this.table.addCol(rng, position);
|
767
|
+
this.afterCommand();
|
768
|
+
}
|
769
|
+
}
|
770
|
+
|
771
|
+
deleteRow() {
|
772
|
+
const rng = this.createRange(this.$editable);
|
773
|
+
if (rng.isCollapsed() && rng.isOnCell()) {
|
774
|
+
this.beforeCommand();
|
775
|
+
this.table.deleteRow(rng);
|
776
|
+
this.afterCommand();
|
777
|
+
}
|
778
|
+
}
|
779
|
+
|
780
|
+
deleteCol() {
|
781
|
+
const rng = this.createRange(this.$editable);
|
782
|
+
if (rng.isCollapsed() && rng.isOnCell()) {
|
783
|
+
this.beforeCommand();
|
784
|
+
this.table.deleteCol(rng);
|
785
|
+
this.afterCommand();
|
786
|
+
}
|
787
|
+
}
|
788
|
+
|
789
|
+
deleteTable() {
|
790
|
+
const rng = this.createRange(this.$editable);
|
791
|
+
if (rng.isCollapsed() && rng.isOnCell()) {
|
792
|
+
this.beforeCommand();
|
793
|
+
this.table.deleteTable(rng);
|
794
|
+
this.afterCommand();
|
795
|
+
}
|
796
|
+
}
|
797
|
+
|
798
|
+
/**
|
799
|
+
* @param {Position} pos
|
800
|
+
* @param {jQuery} $target - target element
|
801
|
+
* @param {Boolean} [bKeepRatio] - keep ratio
|
802
|
+
*/
|
803
|
+
resizeTo(pos, $target, bKeepRatio) {
|
804
|
+
let imageSize;
|
805
|
+
if (bKeepRatio) {
|
806
|
+
const newRatio = pos.y / pos.x;
|
807
|
+
const ratio = $target.data('ratio');
|
808
|
+
imageSize = {
|
809
|
+
width: ratio > newRatio ? pos.x : pos.y / ratio,
|
810
|
+
height: ratio > newRatio ? pos.x * ratio : pos.y
|
811
|
+
};
|
812
|
+
} else {
|
813
|
+
imageSize = {
|
814
|
+
width: pos.x,
|
815
|
+
height: pos.y
|
816
|
+
};
|
817
|
+
}
|
818
|
+
|
819
|
+
$target.css(imageSize);
|
820
|
+
}
|
821
|
+
|
822
|
+
/**
|
823
|
+
* returns whether editable area has focus or not.
|
824
|
+
*/
|
825
|
+
hasFocus() {
|
826
|
+
return this.$editable.is(':focus');
|
827
|
+
}
|
828
|
+
|
829
|
+
/**
|
830
|
+
* set focus
|
831
|
+
*/
|
832
|
+
focus() {
|
833
|
+
// [workaround] Screen will move when page is scolled in IE.
|
834
|
+
// - do focus when not focused
|
835
|
+
if (!this.hasFocus()) {
|
836
|
+
this.$editable.focus();
|
837
|
+
}
|
838
|
+
}
|
839
|
+
|
840
|
+
/**
|
841
|
+
* returns whether contents is empty or not.
|
842
|
+
* @return {Boolean}
|
843
|
+
*/
|
844
|
+
isEmpty() {
|
845
|
+
return dom.isEmpty(this.$editable[0]) || dom.emptyPara === this.$editable.html();
|
846
|
+
}
|
847
|
+
|
848
|
+
/**
|
849
|
+
* Removes all contents and restores the editable instance to an _emptyPara_.
|
850
|
+
*/
|
851
|
+
empty() {
|
852
|
+
this.context.invoke('code', dom.emptyPara);
|
853
|
+
}
|
854
|
+
|
855
|
+
/**
|
856
|
+
* normalize content
|
857
|
+
*/
|
858
|
+
normalizeContent() {
|
859
|
+
this.$editable[0].normalize();
|
860
|
+
}
|
861
|
+
}
|