xmt_froala 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/xmt_froala.js +31 -0
- data/app/assets/stylesheets/xmt_froala.css +17 -0
- data/app/controllers/xmt_froala/application_controller.rb +5 -0
- data/app/controllers/xmt_froala/assets_controller.rb +94 -0
- data/app/models/xmt_froala/asset_uploader.rb +107 -0
- data/app/models/xmt_froala/file_uploader.rb +10 -0
- data/app/models/xmt_froala/flash_uploader.rb +10 -0
- data/app/models/xmt_froala/image_uploader.rb +10 -0
- data/app/models/xmt_froala/media_uploader.rb +10 -0
- data/config/routes.rb +6 -0
- data/lib/generators/xmt_froala/install/USAGE +10 -0
- data/lib/generators/xmt_froala/install/install_generator.rb +23 -0
- data/lib/generators/xmt_froala/install/templates/application.js +17 -0
- data/lib/generators/xmt_froala/install/templates/xmt_froala.rb +29 -0
- data/lib/generators/xmt_froala/migration/USAGE +14 -0
- data/lib/generators/xmt_froala/migration/migration_generator.rb +36 -0
- data/lib/generators/xmt_froala/migration/templates/migration/migration.rb +18 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/asset.rb +14 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/file.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/flash.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/image.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/active_record/xmt_froala/media.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/asset.rb +27 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/file.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/flash.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/image.rb +3 -0
- data/lib/generators/xmt_froala/migration/templates/models/mongoid/xmt_froala/media.rb +3 -0
- data/lib/tasks/xmt_froala_tasks.rake +9 -0
- data/lib/xmt_froala.rb +65 -0
- data/lib/xmt_froala/active_record.rb +14 -0
- data/lib/xmt_froala/engine.rb +32 -0
- data/lib/xmt_froala/formtastic.rb +12 -0
- data/lib/xmt_froala/helper.rb +105 -0
- data/lib/xmt_froala/simple_form.rb +11 -0
- data/lib/xmt_froala/version.rb +3 -0
- data/vendor/assets/javascripts/xmt_froala/froala_editor.js +0 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ar.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/bs.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/cs.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/da.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/de.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/en_ca.js +262 -0
- data/vendor/assets/javascripts/xmt_froala/languages/en_gb.js +262 -0
- data/vendor/assets/javascripts/xmt_froala/languages/es.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/et.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/fa.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/fi.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/fr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/he.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/hr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/hu.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/id.js +319 -0
- data/vendor/assets/javascripts/xmt_froala/languages/it.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ja.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ko.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/me.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/nb.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/nl.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/pl.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/pt_br.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/pt_pt.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ro.js +319 -0
- data/vendor/assets/javascripts/xmt_froala/languages/ru.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/sk.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/sr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/sv.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/th.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/tr.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/uk.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/languages/vi.js +258 -0
- data/vendor/assets/javascripts/xmt_froala/languages/zh_cn.js +320 -0
- data/vendor/assets/javascripts/xmt_froala/languages/zh_tw.js +318 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/align.js +139 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/align.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/char_counter.js +154 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/char_counter.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_beautifier.js +3270 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_beautifier.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_view.js +393 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/code_view.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/colors.js +492 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/colors.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/draggable.js +459 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/draggable.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/emoticons.js +509 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/emoticons.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/entities.js +121 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/entities.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/file.js +736 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/file.min.js +239 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_family.js +182 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_family.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_size.js +118 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/font_size.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/forms.js +430 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/forms.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/fullscreen.js +274 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/fullscreen.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/help.js +216 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/help.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image.js +3323 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image_manager.js +1056 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/image_manager.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/inline_style.js +94 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/inline_style.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/line_breaker.js +537 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/line_breaker.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/link.js +1157 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/link.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/lists.js +462 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/lists.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_format.js +290 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_format.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_style.js +144 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/paragraph_style.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/plain_paste.js +96 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/print.js +137 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/print.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quick_format.js +89 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quick_insert.js +478 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quick_insert.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quote.js +141 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/quote.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/save.js +189 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/save.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/special_characters.js +781 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/special_characters.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/table.js +4194 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/table.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/url.js +194 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/url.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/video.js +2342 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/video.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/word_paste.js +1403 -0
- data/vendor/assets/javascripts/xmt_froala/plugins/word_paste.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/embedly.js +543 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/embedly.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/image_aviary.js +163 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/image_aviary.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/spell_checker.js +222 -0
- data/vendor/assets/javascripts/xmt_froala/third_party/spell_checker.min.js +7 -0
- data/vendor/assets/javascripts/xmt_froala/xmt_froala.js +15172 -0
- data/vendor/assets/stylesheets/xmt_froala/css/font-awesome.css +2546 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.pkgd.css +2902 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_editor.pkgd.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_style.css +413 -0
- data/vendor/assets/stylesheets/xmt_froala/css/froala_style.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/char_counter.css +57 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/char_counter.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/code_view.css +112 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/code_view.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/colors.css +155 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/colors.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/draggable.css +43 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/draggable.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/emoticons.css +42 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/emoticons.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/file.css +146 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/file.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/fullscreen.css +28 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/fullscreen.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/help.css +52 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/help.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image.css +244 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image_manager.css +266 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/image_manager.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/line_breaker.css +37 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/line_breaker.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/quick_insert.css +70 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/quick_insert.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/special_characters.css +51 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/special_characters.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/table.css +181 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/table.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/video.css +231 -0
- data/vendor/assets/stylesheets/xmt_froala/css/plugins/video.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/dark.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/dark.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/gray.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/gray.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/red.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/red.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/royal.css +1281 -0
- data/vendor/assets/stylesheets/xmt_froala/css/themes/royal.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/embedly.css +64 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/embedly.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/spell_checker.css +72 -0
- data/vendor/assets/stylesheets/xmt_froala/css/third_party/spell_checker.min.css +7 -0
- data/vendor/assets/stylesheets/xmt_froala/css/xmt_froala.css +1423 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/FontAwesome.otf +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.svg +2671 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/stylesheets/xmt_froala/fonts/fontawesome-webfont.woff2 +0 -0
- metadata +273 -0
@@ -0,0 +1,7 @@
|
|
1
|
+
/*!
|
2
|
+
* froala_editor v2.8.1 (https://www.froala.com/wysiwyg-editor)
|
3
|
+
* License https://froala.com/wysiwyg-editor/terms/
|
4
|
+
* Copyright 2014-2018 Froala Labs
|
5
|
+
*/
|
6
|
+
|
7
|
+
!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t)}:n(window.jQuery)}(function(v){v.extend(v.FE.DEFAULTS,{dragInline:!0}),v.FE.PLUGINS.draggable=function(f){function e(e){return!(!e.originalEvent||!e.originalEvent.target||e.originalEvent.target.nodeType!=Node.TEXT_NODE)||(e.target&&"A"==e.target.tagName&&1==e.target.childNodes.length&&"IMG"==e.target.childNodes[0].tagName&&(e.target=e.target.childNodes[0]),v(e.target).hasClass("fr-draggable")?(f.undo.canDo()||f.undo.saveStep(),f.opts.dragInline?f.$el.attr("contenteditable",!0):f.$el.attr("contenteditable",!1),f.opts.toolbarInline&&f.toolbar.hide(),v(e.target).addClass("fr-dragging"),f.browser.msie||f.browser.edge||f.selection.clear(),void e.originalEvent.dataTransfer.setData("text","Froala")):(e.preventDefault(),!1))}function g(e){return!(e&&("HTML"==e.tagName||"BODY"==e.tagName||f.node.isElement(e)))}function d(e,t,n){f.opts.iframe&&(e+=f.$iframe.offset().top,t+=f.$iframe.offset().left),p.offset().top!=e&&p.css("top",e),p.offset().left!=t&&p.css("left",t),p.width()!=n&&p.css("width",n)}function t(e){e.originalEvent.dataTransfer.dropEffect="move",f.opts.dragInline?function(){for(var e=null,t=0;t<v.FE.INSTANCES.length;t++)if((e=v.FE.INSTANCES[t].$el.find(".fr-dragging")).length)return e.get(0)}()||!f.browser.msie&&!f.browser.edge||e.preventDefault():(e.preventDefault(),function(e){var t=f.doc.elementFromPoint(e.originalEvent.pageX-f.win.pageXOffset,e.originalEvent.pageY-f.win.pageYOffset);if(!g(t)){for(var n=0,r=t;!g(r)&&r==t&&0<e.originalEvent.pageY-f.win.pageYOffset-n;)n++,r=f.doc.elementFromPoint(e.originalEvent.pageX-f.win.pageXOffset,e.originalEvent.pageY-f.win.pageYOffset-n);(!g(r)||p&&0===f.$el.find(r).length&&r!=p.get(0))&&(r=null);for(var a=0,o=t;!g(o)&&o==t&&e.originalEvent.pageY-f.win.pageYOffset+a<v(f.doc).height();)a++,o=f.doc.elementFromPoint(e.originalEvent.pageX-f.win.pageXOffset,e.originalEvent.pageY-f.win.pageYOffset+a);(!g(o)||p&&0===f.$el.find(o).length&&o!=p.get(0))&&(o=null),t=null==o&&r?r:o&&null==r?o:o&&r?n<a?r:o:null}if(v(t).hasClass("fr-drag-helper"))return;if(t&&!f.node.isBlock(t)&&(t=f.node.blockParent(t)),t&&0<=["TD","TH","TR","THEAD","TBODY"].indexOf(t.tagName)&&(t=v(t).parents("table").get(0)),t&&0<=["LI"].indexOf(t.tagName)&&(t=v(t).parents("UL, OL").get(0)),t&&!v(t).hasClass("fr-drag-helper")){var i;p||(v.FE.$draggable_helper||(v.FE.$draggable_helper=v('<div class="fr-drag-helper"></div>')),p=v.FE.$draggable_helper,f.events.on("shared.destroy",function(){p.html("").removeData().remove(),p=null},!0)),i=e.originalEvent.pageY<v(t).offset().top+v(t).outerHeight()/2;var l=v(t),s=0;i||0!==l.next().length?(i||(l=l.next()),"before"==p.data("fr-position")&&l.is(p.data("fr-tag"))||(0<l.prev().length&&(s=parseFloat(l.prev().css("margin-bottom"))||0),s=Math.max(s,parseFloat(l.css("margin-top"))||0),d(l.offset().top-s/2-f.$box.offset().top,l.offset().left-f.win.pageXOffset-f.$box.offset().left,l.width()),p.data("fr-position","before"))):"after"==p.data("fr-position")&&l.is(p.data("fr-tag"))||(s=parseFloat(l.css("margin-bottom"))||0,d(l.offset().top+v(t).height()+s/2-f.$box.offset().top,l.offset().left-f.win.pageXOffset-f.$box.offset().left,l.width()),p.data("fr-position","after")),p.data("fr-tag",l),p.addClass("fr-visible"),p.appendTo(f.$box)}else p&&0<f.$box.find(p).length&&p.removeClass("fr-visible")}(e))}function n(e){e.originalEvent.dataTransfer.dropEffect="move",f.opts.dragInline||e.preventDefault()}function r(e){f.$el.attr("contenteditable",!0);var t=f.$el.find(".fr-dragging");p&&p.hasClass("fr-visible")&&f.$box.find(p).length?a(e):t.length&&(e.preventDefault(),e.stopPropagation()),p&&f.$box.find(p).length&&p.removeClass("fr-visible"),t.removeClass("fr-dragging")}function a(e){for(var t,n,r=0;r<v.FE.INSTANCES.length;r++)if((t=v.FE.INSTANCES[r].$el.find(".fr-dragging")).length){n=v.FE.INSTANCES[r];break}if(t.length){if(e.preventDefault(),e.stopPropagation(),p&&p.hasClass("fr-visible")&&f.$box.find(p).length)p.data("fr-tag")[p.data("fr-position")]('<span class="fr-marker"></span>'),p.removeClass("fr-visible");else if(!1===f.markers.insertAtPoint(e.originalEvent))return!1;if(t.removeClass("fr-dragging"),!1===(t=f.events.chainTrigger("element.beforeDrop",t)))return!1;var a=t;if(t.parent().is("A")&&1==t.parent().get(0).childNodes.length&&(a=t.parent()),f.core.isEmpty())f.events.focus();else f.$el.find(".fr-marker").replaceWith(v.FE.MARKERS),f.selection.restore();if(n==f||f.undo.canDo()||f.undo.saveStep(),f.core.isEmpty())f.$el.html(a);else{var o=f.markers.insert();0===a.find(o).length?v(o).replaceWith(a):0===t.find(o).length&&v(o).replaceWith(t),t.after(v.FE.MARKERS),f.selection.restore()}return f.popups.hideAll(),f.selection.save(),f.$el.find(f.html.emptyBlockTagsQuery()).not("TD, TH, LI, .fr-inner").not(f.opts.htmlAllowedEmptyTags.join(",")).remove(),f.html.wrap(),f.html.fillEmptyBlocks(),f.selection.restore(),f.undo.saveStep(),f.opts.iframe&&f.size.syncIframe(),n!=f&&(n.popups.hideAll(),n.$el.find(n.html.emptyBlockTagsQuery()).not("TD, TH, LI, .fr-inner").remove(),n.html.wrap(),n.html.fillEmptyBlocks(),n.undo.saveStep(),n.events.trigger("element.dropped"),n.opts.iframe&&n.size.syncIframe()),f.events.trigger("element.dropped",[a]),!1}p&&p.removeClass("fr-visible"),f.undo.canDo()||f.undo.saveStep(),setTimeout(function(){f.undo.saveStep()},0)}function o(e){if(e&&"DIV"==e.tagName&&f.node.hasClass(e,"fr-drag-helper"))e.parentNode.removeChild(e);else if(e&&e.nodeType==Node.ELEMENT_NODE)for(var t=e.querySelectorAll("div.fr-drag-helper"),n=0;n<t.length;n++)t[n].parentNode.removeChild(t[n])}var p;return{_init:function(){f.opts.enter==v.FE.ENTER_BR&&(f.opts.dragInline=!0),f.events.on("dragstart",e,!0),f.events.on("dragover",t,!0),f.events.on("dragenter",n,!0),f.events.on("document.dragend",r,!0),f.events.on("document.drop",r,!0),f.events.on("drop",a,!0),f.events.on("html.processGet",o)}}}});
|
@@ -0,0 +1,509 @@
|
|
1
|
+
/*!
|
2
|
+
* froala_editor v2.8.1 (https://www.froala.com/wysiwyg-editor)
|
3
|
+
* License https://froala.com/wysiwyg-editor/terms/
|
4
|
+
* Copyright 2014-2018 Froala Labs
|
5
|
+
*/
|
6
|
+
|
7
|
+
(function (factory) {
|
8
|
+
if (typeof define === 'function' && define.amd) {
|
9
|
+
// AMD. Register as an anonymous module.
|
10
|
+
define(['jquery'], factory);
|
11
|
+
} else if (typeof module === 'object' && module.exports) {
|
12
|
+
// Node/CommonJS
|
13
|
+
module.exports = function( root, jQuery ) {
|
14
|
+
if ( jQuery === undefined ) {
|
15
|
+
// require('jQuery') returns a factory that requires window to
|
16
|
+
// build a jQuery instance, we normalize how we use modules
|
17
|
+
// that require this pattern but the window provided is a noop
|
18
|
+
// if it's defined (how jquery works)
|
19
|
+
if ( typeof window !== 'undefined' ) {
|
20
|
+
jQuery = require('jquery');
|
21
|
+
}
|
22
|
+
else {
|
23
|
+
jQuery = require('jquery')(root);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return factory(jQuery);
|
27
|
+
};
|
28
|
+
} else {
|
29
|
+
// Browser globals
|
30
|
+
factory(window.jQuery);
|
31
|
+
}
|
32
|
+
}(function ($) {
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
$.extend($.FE.POPUP_TEMPLATES, {
|
37
|
+
emoticons: '[_BUTTONS_][_EMOTICONS_]'
|
38
|
+
})
|
39
|
+
|
40
|
+
// Extend defaults.
|
41
|
+
$.extend($.FE.DEFAULTS, {
|
42
|
+
emoticonsStep: 8,
|
43
|
+
emoticonsSet: [
|
44
|
+
{ code: '1f600', desc: 'Grinning face' },
|
45
|
+
{ code: '1f601', desc: 'Grinning face with smiling eyes' },
|
46
|
+
{ code: '1f602', desc: 'Face with tears of joy' },
|
47
|
+
{ code: '1f603', desc: 'Smiling face with open mouth' },
|
48
|
+
{ code: '1f604', desc: 'Smiling face with open mouth and smiling eyes' },
|
49
|
+
{ code: '1f605', desc: 'Smiling face with open mouth and cold sweat' },
|
50
|
+
{ code: '1f606', desc: 'Smiling face with open mouth and tightly-closed eyes' },
|
51
|
+
{ code: '1f607', desc: 'Smiling face with halo' },
|
52
|
+
|
53
|
+
{ code: '1f608', desc: 'Smiling face with horns' },
|
54
|
+
{ code: '1f609', desc: 'Winking face' },
|
55
|
+
{ code: '1f60a', desc: 'Smiling face with smiling eyes' },
|
56
|
+
{ code: '1f60b', desc: 'Face savoring delicious food' },
|
57
|
+
{ code: '1f60c', desc: 'Relieved face' },
|
58
|
+
{ code: '1f60d', desc: 'Smiling face with heart-shaped eyes' },
|
59
|
+
{ code: '1f60e', desc: 'Smiling face with sunglasses' },
|
60
|
+
{ code: '1f60f', desc: 'Smirking face' },
|
61
|
+
|
62
|
+
{ code: '1f610', desc: 'Neutral face' },
|
63
|
+
{ code: '1f611', desc: 'Expressionless face' },
|
64
|
+
{ code: '1f612', desc: 'Unamused face' },
|
65
|
+
{ code: '1f613', desc: 'Face with cold sweat' },
|
66
|
+
{ code: '1f614', desc: 'Pensive face' },
|
67
|
+
{ code: '1f615', desc: 'Confused face' },
|
68
|
+
{ code: '1f616', desc: 'Confounded face' },
|
69
|
+
{ code: '1f617', desc: 'Kissing face' },
|
70
|
+
|
71
|
+
{ code: '1f618', desc: 'Face throwing a kiss' },
|
72
|
+
{ code: '1f619', desc: 'Kissing face with smiling eyes' },
|
73
|
+
{ code: '1f61a', desc: 'Kissing face with closed eyes' },
|
74
|
+
{ code: '1f61b', desc: 'Face with stuck out tongue' },
|
75
|
+
{ code: '1f61c', desc: 'Face with stuck out tongue and winking eye' },
|
76
|
+
{ code: '1f61d', desc: 'Face with stuck out tongue and tightly-closed eyes' },
|
77
|
+
{ code: '1f61e', desc: 'Disappointed face' },
|
78
|
+
{ code: '1f61f', desc: 'Worried face' },
|
79
|
+
|
80
|
+
{ code: '1f620', desc: 'Angry face' },
|
81
|
+
{ code: '1f621', desc: 'Pouting face' },
|
82
|
+
{ code: '1f622', desc: 'Crying face' },
|
83
|
+
{ code: '1f623', desc: 'Persevering face' },
|
84
|
+
{ code: '1f624', desc: 'Face with look of triumph' },
|
85
|
+
{ code: '1f625', desc: 'Disappointed but relieved face' },
|
86
|
+
{ code: '1f626', desc: 'Frowning face with open mouth' },
|
87
|
+
{ code: '1f627', desc: 'Anguished face' },
|
88
|
+
|
89
|
+
{ code: '1f628', desc: 'Fearful face' },
|
90
|
+
{ code: '1f629', desc: 'Weary face' },
|
91
|
+
{ code: '1f62a', desc: 'Sleepy face' },
|
92
|
+
{ code: '1f62b', desc: 'Tired face' },
|
93
|
+
{ code: '1f62c', desc: 'Grimacing face' },
|
94
|
+
{ code: '1f62d', desc: 'Loudly crying face' },
|
95
|
+
{ code: '1f62e', desc: 'Face with open mouth' },
|
96
|
+
{ code: '1f62f', desc: 'Hushed face' },
|
97
|
+
|
98
|
+
{ code: '1f630', desc: 'Face with open mouth and cold sweat' },
|
99
|
+
{ code: '1f631', desc: 'Face screaming in fear' },
|
100
|
+
{ code: '1f632', desc: 'Astonished face' },
|
101
|
+
{ code: '1f633', desc: 'Flushed face' },
|
102
|
+
{ code: '1f634', desc: 'Sleeping face' },
|
103
|
+
{ code: '1f635', desc: 'Dizzy face' },
|
104
|
+
{ code: '1f636', desc: 'Face without mouth' },
|
105
|
+
{ code: '1f637', desc: 'Face with medical mask' }
|
106
|
+
],
|
107
|
+
emoticonsButtons: ['emoticonsBack', '|'],
|
108
|
+
emoticonsUseImage: true
|
109
|
+
});
|
110
|
+
|
111
|
+
$.FE.PLUGINS.emoticons = function (editor) {
|
112
|
+
/*
|
113
|
+
* Show the emoticons popup.
|
114
|
+
*/
|
115
|
+
function _showEmoticonsPopup () {
|
116
|
+
var $btn = editor.$tb.find('.fr-command[data-cmd="emoticons"]');
|
117
|
+
|
118
|
+
var $popup = editor.popups.get('emoticons');
|
119
|
+
|
120
|
+
if (!$popup) $popup = _initEmoticonsPopup();
|
121
|
+
|
122
|
+
if (!$popup.hasClass('fr-active')) {
|
123
|
+
|
124
|
+
// Emoticons popup.
|
125
|
+
editor.popups.refresh('emoticons');
|
126
|
+
editor.popups.setContainer('emoticons', editor.$tb);
|
127
|
+
|
128
|
+
// Emoticons popup left and top position.
|
129
|
+
var left = $btn.offset().left + $btn.outerWidth() / 2;
|
130
|
+
var top = $btn.offset().top + (editor.opts.toolbarBottom ? 10 : $btn.outerHeight() - 10);
|
131
|
+
|
132
|
+
editor.popups.show('emoticons', left, top, $btn.outerHeight());
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
/*
|
137
|
+
* Hide emoticons popup.
|
138
|
+
*/
|
139
|
+
function _hideEmoticonsPopup () {
|
140
|
+
|
141
|
+
// Hide popup.
|
142
|
+
editor.popups.hide('emoticons');
|
143
|
+
}
|
144
|
+
|
145
|
+
/**
|
146
|
+
* Init the emoticons popup.
|
147
|
+
*/
|
148
|
+
function _initEmoticonsPopup () {
|
149
|
+
var emoticons_buttons = '';
|
150
|
+
|
151
|
+
if (editor.opts.toolbarInline) {
|
152
|
+
|
153
|
+
// Emoticons buttons.
|
154
|
+
if (editor.opts.emoticonsButtons.length > 0) {
|
155
|
+
emoticons_buttons = '<div class="fr-buttons fr-emoticons-buttons">' + editor.button.buildList(editor.opts.emoticonsButtons) + '</div>';
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
var template = {
|
160
|
+
buttons: emoticons_buttons,
|
161
|
+
emoticons: _emoticonsHTML()
|
162
|
+
};
|
163
|
+
|
164
|
+
// Create popup.
|
165
|
+
var $popup = editor.popups.create('emoticons', template);
|
166
|
+
|
167
|
+
// Assing tooltips to buttons.
|
168
|
+
editor.tooltip.bind($popup, '.fr-emoticon');
|
169
|
+
|
170
|
+
_addAccessibility($popup);
|
171
|
+
|
172
|
+
return $popup;
|
173
|
+
}
|
174
|
+
|
175
|
+
function _inEmoticon () {
|
176
|
+
if (!editor.selection.isCollapsed()) return false;
|
177
|
+
|
178
|
+
var s_el = editor.selection.element();
|
179
|
+
var e_el = editor.selection.endElement();
|
180
|
+
|
181
|
+
if (s_el && editor.node.hasClass(s_el, 'fr-emoticon')) return s_el;
|
182
|
+
|
183
|
+
if (e_el && editor.node.hasClass(e_el, 'fr-emoticon')) return e_el;
|
184
|
+
|
185
|
+
var range = editor.selection.ranges(0);
|
186
|
+
var container = range.startContainer;
|
187
|
+
|
188
|
+
if (container.nodeType == Node.ELEMENT_NODE) {
|
189
|
+
|
190
|
+
if (container.childNodes.length > 0 && range.startOffset > 0) {
|
191
|
+
var node = container.childNodes[range.startOffset - 1];
|
192
|
+
|
193
|
+
if (editor.node.hasClass(node, 'fr-emoticon')) {
|
194
|
+
|
195
|
+
return node;
|
196
|
+
}
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
return false;
|
201
|
+
}
|
202
|
+
|
203
|
+
/*
|
204
|
+
* HTML for the emoticons popup.
|
205
|
+
*/
|
206
|
+
function _emoticonsHTML () {
|
207
|
+
|
208
|
+
// Create emoticons html.
|
209
|
+
var emoticons_html = '<div style="text-align: center">';
|
210
|
+
|
211
|
+
// Add emoticons.
|
212
|
+
for (var i = 0; i < editor.opts.emoticonsSet.length; i++) {
|
213
|
+
if (i !== 0 && i % editor.opts.emoticonsStep === 0) {
|
214
|
+
emoticons_html += '<br>';
|
215
|
+
}
|
216
|
+
|
217
|
+
emoticons_html += '<span class="fr-command fr-emoticon" tabIndex="-1" data-cmd="insertEmoticon" title="' + editor.language.translate(editor.opts.emoticonsSet[i].desc) + '" role="button" data-param1="' + editor.opts.emoticonsSet[i].code + '">' + (editor.opts.emoticonsUseImage ? '<img src="' + 'https://cdnjs.cloudflare.com/ajax/libs/emojione/2.0.1/assets/svg/' + editor.opts.emoticonsSet[i].code + '.svg' + '"/>' : '&#x' + editor.opts.emoticonsSet[i].code + ';') + '<span class="fr-sr-only">' + editor.language.translate(editor.opts.emoticonsSet[i].desc) + ' </span></span>';
|
218
|
+
}
|
219
|
+
|
220
|
+
if (editor.opts.emoticonsUseImage) emoticons_html += '<p style="font-size: 12px; text-align: center; padding: 0 5px;">Emoji free by <a class="fr-link" tabIndex="-1" href="http://emojione.com/" target="_blank" rel="nofollow" role="link" aria-label="Open Emoji One website.">Emoji One</a></p>';
|
221
|
+
emoticons_html += '</div>';
|
222
|
+
|
223
|
+
return emoticons_html;
|
224
|
+
}
|
225
|
+
|
226
|
+
/*
|
227
|
+
* Register keyboard events.
|
228
|
+
*/
|
229
|
+
function _addAccessibility ($popup) {
|
230
|
+
|
231
|
+
// Register popup event.
|
232
|
+
editor.events.on('popup.tab', function (e) {
|
233
|
+
var $focused_item = $(e.currentTarget);
|
234
|
+
|
235
|
+
// Skip if popup is not visible or focus is elsewere.
|
236
|
+
if (!editor.popups.isVisible('emoticons') || !$focused_item.is('span, a')) {
|
237
|
+
return true;
|
238
|
+
}
|
239
|
+
|
240
|
+
var key_code = e.which;
|
241
|
+
var status;
|
242
|
+
var index;
|
243
|
+
var $el;
|
244
|
+
|
245
|
+
// Tabbing.
|
246
|
+
if ($.FE.KEYCODE.TAB == key_code) {
|
247
|
+
|
248
|
+
// Extremities reached.
|
249
|
+
if (($focused_item.is('span.fr-emoticon') && e.shiftKey) || ($focused_item.is('a') && !e.shiftKey)) {
|
250
|
+
var $tb = $popup.find('.fr-buttons');
|
251
|
+
|
252
|
+
// Focus back the popup's toolbar if exists.
|
253
|
+
status = !editor.accessibility.focusToolbar($tb, (e.shiftKey ? true : false));
|
254
|
+
}
|
255
|
+
|
256
|
+
if (status !== false) {
|
257
|
+
|
258
|
+
// Build elements that should be focused next.
|
259
|
+
var $tabElements = $popup.find('span.fr-emoticon:focus:first, span.fr-emoticon:visible:first, a');
|
260
|
+
|
261
|
+
if ($focused_item.is('span.fr-emoticon')) {
|
262
|
+
$tabElements = $tabElements.not('span.fr-emoticon:not(:focus)');
|
263
|
+
}
|
264
|
+
|
265
|
+
// Get focused item position.
|
266
|
+
index = $tabElements.index($focused_item);
|
267
|
+
|
268
|
+
// Backwards.
|
269
|
+
if (e.shiftKey) {
|
270
|
+
index = (((index - 1) % $tabElements.length) + $tabElements.length) % $tabElements.length;
|
271
|
+
|
272
|
+
// Javascript negative modulo bug.
|
273
|
+
// Forward.
|
274
|
+
}
|
275
|
+
else {
|
276
|
+
index = (index + 1) % $tabElements.length;
|
277
|
+
}
|
278
|
+
|
279
|
+
// Find next element to focus.
|
280
|
+
$el = $tabElements.get(index);
|
281
|
+
|
282
|
+
editor.events.disableBlur();
|
283
|
+
$el.focus();
|
284
|
+
status = false;
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
// Arrows.
|
289
|
+
else if ($.FE.KEYCODE.ARROW_UP == key_code || $.FE.KEYCODE.ARROW_DOWN == key_code || $.FE.KEYCODE.ARROW_LEFT == key_code || $.FE.KEYCODE.ARROW_RIGHT == key_code) {
|
290
|
+
if ($focused_item.is('span.fr-emoticon')) {
|
291
|
+
|
292
|
+
// Get all current emoticons.
|
293
|
+
var $emoticons = $focused_item.parent().find('span.fr-emoticon');
|
294
|
+
|
295
|
+
// Get focused item position.
|
296
|
+
index = $emoticons.index($focused_item);
|
297
|
+
|
298
|
+
// Get emoticons matrix dimensions.
|
299
|
+
var columns = editor.opts.emoticonsStep;
|
300
|
+
var lines = Math.floor($emoticons.length / columns);
|
301
|
+
|
302
|
+
// Get focused item coordinates.
|
303
|
+
var column = index % columns;
|
304
|
+
var line = Math.floor(index / columns);
|
305
|
+
|
306
|
+
var nextIndex = line * columns + column;
|
307
|
+
var dimension = lines * columns;
|
308
|
+
|
309
|
+
// Calculate next index. Go to the other opposite site of the matrix if there is no next adjacent element.
|
310
|
+
// Up/Down: Traverse matrix lines.
|
311
|
+
// Left/Right: Traverse the matrix as it is a vector.
|
312
|
+
if ($.FE.KEYCODE.ARROW_UP == key_code) {
|
313
|
+
nextIndex = (((nextIndex - columns) % dimension) + dimension) % dimension; // Javascript negative modulo bug.
|
314
|
+
}
|
315
|
+
else if ($.FE.KEYCODE.ARROW_DOWN == key_code) {
|
316
|
+
nextIndex = (nextIndex + columns) % dimension;
|
317
|
+
}
|
318
|
+
else if ($.FE.KEYCODE.ARROW_LEFT == key_code) {
|
319
|
+
nextIndex = (((nextIndex - 1) % dimension) + dimension) % dimension; // Javascript negative modulo bug.
|
320
|
+
}
|
321
|
+
else if ($.FE.KEYCODE.ARROW_RIGHT == key_code) {
|
322
|
+
nextIndex = (nextIndex + 1) % dimension;
|
323
|
+
}
|
324
|
+
|
325
|
+
// Get the next element based on the new index.
|
326
|
+
$el = $($emoticons.get(nextIndex));
|
327
|
+
|
328
|
+
// Focus.
|
329
|
+
editor.events.disableBlur();
|
330
|
+
$el.focus();
|
331
|
+
|
332
|
+
status = false;
|
333
|
+
}
|
334
|
+
}
|
335
|
+
|
336
|
+
// ENTER or SPACE.
|
337
|
+
else if ($.FE.KEYCODE.ENTER == key_code) {
|
338
|
+
if ($focused_item.is('a')) {
|
339
|
+
$focused_item[0].click();
|
340
|
+
}
|
341
|
+
else {
|
342
|
+
editor.button.exec($focused_item);
|
343
|
+
}
|
344
|
+
status = false;
|
345
|
+
}
|
346
|
+
|
347
|
+
// Prevent propagation.
|
348
|
+
if (status === false) {
|
349
|
+
e.preventDefault();
|
350
|
+
e.stopPropagation();
|
351
|
+
}
|
352
|
+
|
353
|
+
return status;
|
354
|
+
}, true);
|
355
|
+
}
|
356
|
+
|
357
|
+
/*
|
358
|
+
* Insert emoticon.
|
359
|
+
*/
|
360
|
+
function insert (emoticon, img) {
|
361
|
+
|
362
|
+
// Insert emoticon.
|
363
|
+
var el = _inEmoticon();
|
364
|
+
var range = editor.selection.ranges(0);
|
365
|
+
|
366
|
+
if (!el) {
|
367
|
+
editor.html.insert('<span class="fr-emoticon fr-deletable' + (img ? ' fr-emoticon-img' : '') + '"' + (img ? ' style="background: url(' + img + ');"' : '') + '>' + (img ? ' ' : emoticon) + '</span>' + ' ', true);
|
368
|
+
|
369
|
+
}
|
370
|
+
else {
|
371
|
+
|
372
|
+
if (range.startOffset === 0 && editor.selection.element() === el) {
|
373
|
+
$(el).before($.FE.MARKERS + $.FE.INVISIBLE_SPACE);
|
374
|
+
}
|
375
|
+
else if (range.startOffset > 0 && editor.selection.element() === el && range.commonAncestorContainer.parentNode.classList.contains('fr-emoticon')) {
|
376
|
+
|
377
|
+
// Inside emoticon move out side of it.
|
378
|
+
$(el).after($.FE.INVISIBLE_SPACE + $.FE.MARKERS);
|
379
|
+
}
|
380
|
+
editor.selection.restore();
|
381
|
+
editor.html.insert('<span class="fr-emoticon fr-deletable' + (img ? ' fr-emoticon-img' : '') + '"' + (img ? ' style="background: url(' + img + ');"' : '') + '>' + (img ? ' ' : emoticon) + '</span>' + ' ' + $.FE.MARKERS, true);
|
382
|
+
}
|
383
|
+
}
|
384
|
+
|
385
|
+
/*
|
386
|
+
* Go back to the inline editor.
|
387
|
+
*/
|
388
|
+
function back () {
|
389
|
+
editor.popups.hide('emoticons');
|
390
|
+
editor.toolbar.showInline();
|
391
|
+
}
|
392
|
+
|
393
|
+
/*
|
394
|
+
* Init emoticons.
|
395
|
+
*/
|
396
|
+
function _init () {
|
397
|
+
var setDeletable = function () {
|
398
|
+
var emtcs = editor.el.querySelectorAll('.fr-emoticon:not(.fr-deletable)');
|
399
|
+
|
400
|
+
for (var i = 0; i < emtcs.length; i++) {
|
401
|
+
emtcs[i].className += ' fr-deletable';
|
402
|
+
}
|
403
|
+
}
|
404
|
+
setDeletable();
|
405
|
+
|
406
|
+
editor.events.on('html.set', setDeletable);
|
407
|
+
|
408
|
+
editor.events.on('keydown', function (e) {
|
409
|
+
if (editor.keys.isCharacter(e.which) && editor.selection.inEditor()) {
|
410
|
+
var range = editor.selection.ranges(0);
|
411
|
+
var el = _inEmoticon();
|
412
|
+
|
413
|
+
if (editor.node.hasClass(el, 'fr-emoticon-img')) {
|
414
|
+
|
415
|
+
if (el) {
|
416
|
+
|
417
|
+
if (range.startOffset === 0 && editor.selection.element() === el) {
|
418
|
+
$(el).before($.FE.MARKERS + $.FE.INVISIBLE_SPACE);
|
419
|
+
}
|
420
|
+
else {
|
421
|
+
$(el).after($.FE.INVISIBLE_SPACE + $.FE.MARKERS);
|
422
|
+
}
|
423
|
+
editor.selection.restore();
|
424
|
+
}
|
425
|
+
}
|
426
|
+
}
|
427
|
+
});
|
428
|
+
|
429
|
+
editor.events.on('keyup', function (e) {
|
430
|
+
var emtcs = editor.el.querySelectorAll('.fr-emoticon');
|
431
|
+
|
432
|
+
for (var i = 0; i < emtcs.length; i++) {
|
433
|
+
if (typeof emtcs[i].textContent != 'undefined' && emtcs[i].textContent.replace(/\u200B/gi, '').length === 0) {
|
434
|
+
$(emtcs[i]).remove();
|
435
|
+
}
|
436
|
+
}
|
437
|
+
|
438
|
+
if (!(e.which >= $.FE.KEYCODE.ARROW_LEFT && e.which <= $.FE.KEYCODE.ARROW_DOWN)) {
|
439
|
+
var el = _inEmoticon();
|
440
|
+
|
441
|
+
if (editor.node.hasClass(el, 'fr-emoticon-img')) {
|
442
|
+
$(el).append($.FE.MARKERS);
|
443
|
+
editor.selection.restore();
|
444
|
+
}
|
445
|
+
}
|
446
|
+
});
|
447
|
+
}
|
448
|
+
|
449
|
+
return {
|
450
|
+
_init: _init,
|
451
|
+
insert: insert,
|
452
|
+
showEmoticonsPopup: _showEmoticonsPopup,
|
453
|
+
hideEmoticonsPopup: _hideEmoticonsPopup,
|
454
|
+
back: back
|
455
|
+
}
|
456
|
+
}
|
457
|
+
|
458
|
+
// Toolbar emoticons button.
|
459
|
+
$.FE.DefineIcon('emoticons', {
|
460
|
+
NAME: 'smile-o',
|
461
|
+
FA5NAME: 'smile'
|
462
|
+
});
|
463
|
+
$.FE.RegisterCommand('emoticons', {
|
464
|
+
title: 'Emoticons',
|
465
|
+
undo: false,
|
466
|
+
focus: true,
|
467
|
+
refreshOnCallback: false,
|
468
|
+
popup: true,
|
469
|
+
callback: function () {
|
470
|
+
if (!this.popups.isVisible('emoticons')) {
|
471
|
+
this.emoticons.showEmoticonsPopup();
|
472
|
+
}
|
473
|
+
else {
|
474
|
+
if (this.$el.find('.fr-marker').length) {
|
475
|
+
this.events.disableBlur();
|
476
|
+
this.selection.restore();
|
477
|
+
}
|
478
|
+
this.popups.hide('emoticons');
|
479
|
+
}
|
480
|
+
},
|
481
|
+
plugin: 'emoticons'
|
482
|
+
});
|
483
|
+
|
484
|
+
// Insert emoticon command.
|
485
|
+
$.FE.RegisterCommand('insertEmoticon', {
|
486
|
+
callback: function (cmd, code) {
|
487
|
+
|
488
|
+
// Insert emoticon.
|
489
|
+
this.emoticons.insert('&#x' + code + ';', this.opts.emoticonsUseImage ? 'https://cdnjs.cloudflare.com/ajax/libs/emojione/2.0.1/assets/svg/' + code + '.svg' : null);
|
490
|
+
|
491
|
+
// Hide emoticons popup.
|
492
|
+
this.emoticons.hideEmoticonsPopup();
|
493
|
+
}
|
494
|
+
});
|
495
|
+
|
496
|
+
// Emoticons back.
|
497
|
+
$.FE.DefineIcon('emoticonsBack', { NAME: 'arrow-left' });
|
498
|
+
$.FE.RegisterCommand('emoticonsBack', {
|
499
|
+
title: 'Back',
|
500
|
+
undo: false,
|
501
|
+
focus: false,
|
502
|
+
back: true,
|
503
|
+
refreshAfterCallback: false,
|
504
|
+
callback: function () {
|
505
|
+
this.emoticons.back();
|
506
|
+
}
|
507
|
+
});
|
508
|
+
|
509
|
+
}));
|