bedrock_sass 0.1.2 → 0.1.3
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 -1
- data/assets/_vendor/tinymce/plugins/advlist/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/advlist/plugin.js +428 -0
- data/assets/_vendor/tinymce/plugins/advlist/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/anchor/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/anchor/plugin.js +338 -0
- data/assets/_vendor/tinymce/plugins/anchor/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autolink/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autolink/plugin.js +404 -0
- data/assets/_vendor/tinymce/plugins/autolink/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autoresize/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autoresize/plugin.js +451 -0
- data/assets/_vendor/tinymce/plugins/autoresize/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autosave/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autosave/plugin.js +608 -0
- data/assets/_vendor/tinymce/plugins/autosave/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/bbcode/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/bbcode/plugin.js +264 -0
- data/assets/_vendor/tinymce/plugins/bbcode/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/charmap/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/charmap/plugin.js +850 -0
- data/assets/_vendor/tinymce/plugins/charmap/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/code/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/code/plugin.js +338 -0
- data/assets/_vendor/tinymce/plugins/code/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/codesample/css/prism.css +138 -0
- data/assets/_vendor/tinymce/plugins/codesample/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/codesample/plugin.js +1582 -0
- data/assets/_vendor/tinymce/plugins/codesample/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/plugin.js +272 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/plugin.js +496 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/directionality/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/directionality/plugin.js +270 -0
- data/assets/_vendor/tinymce/plugins/directionality/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/emoticons/plugin.js +256 -0
- data/assets/_vendor/tinymce/plugins/emoticons/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/fullpage/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/fullpage/plugin.js +962 -0
- data/assets/_vendor/tinymce/plugins/fullpage/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/plugin.js +455 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/help/img/logo.png +0 -0
- data/assets/_vendor/tinymce/plugins/help/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/help/plugin.js +1527 -0
- data/assets/_vendor/tinymce/plugins/help/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/hr/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/hr/plugin.js +195 -0
- data/assets/_vendor/tinymce/plugins/hr/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/image/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/image/plugin.js +1572 -0
- data/assets/_vendor/tinymce/plugins/image/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/imagetools/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/imagetools/plugin.js +4444 -0
- data/assets/_vendor/tinymce/plugins/imagetools/plugin.min.js +2 -0
- data/assets/_vendor/tinymce/plugins/importcss/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/importcss/plugin.js +577 -0
- data/assets/_vendor/tinymce/plugins/importcss/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.js +482 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.js +395 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/link/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/link/plugin.js +1231 -0
- data/assets/_vendor/tinymce/plugins/link/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/lists/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/lists/plugin.js +1985 -0
- data/assets/_vendor/tinymce/plugins/lists/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/media/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/media/plugin.js +2026 -0
- data/assets/_vendor/tinymce/plugins/media/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.js +313 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/noneditable/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/noneditable/plugin.js +316 -0
- data/assets/_vendor/tinymce/plugins/noneditable/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/plugin.js +354 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/paste/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/paste/plugin.js +2935 -0
- data/assets/_vendor/tinymce/plugins/paste/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/preview/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/preview/plugin.js +410 -0
- data/assets/_vendor/tinymce/plugins/preview/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/print/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/print/plugin.js +194 -0
- data/assets/_vendor/tinymce/plugins/print/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/save/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/save/plugin.js +370 -0
- data/assets/_vendor/tinymce/plugins/save/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/plugin.js +977 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/plugin.js +1419 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/plugin.js +419 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/table/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/table/plugin.js +15527 -0
- data/assets/_vendor/tinymce/plugins/table/plugin.min.js +5 -0
- data/assets/_vendor/tinymce/plugins/template/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/template/plugin.js +807 -0
- data/assets/_vendor/tinymce/plugins/template/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/textcolor/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/textcolor/plugin.js +619 -0
- data/assets/_vendor/tinymce/plugins/textcolor/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/textpattern/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/textpattern/plugin.js +718 -0
- data/assets/_vendor/tinymce/plugins/textpattern/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/toc/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/toc/plugin.js +559 -0
- data/assets/_vendor/tinymce/plugins/toc/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/css/visualblocks.css +154 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/plugin.js +459 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/visualchars/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/visualchars/plugin.js +1325 -0
- data/assets/_vendor/tinymce/plugins/visualchars/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/wordcount/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/wordcount/plugin.js +735 -0
- data/assets/_vendor/tinymce/plugins/wordcount/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.inline.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.mobile.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-mobile.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.svg +63 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.svg +131 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/object.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/trans.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/skin.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/skin.mobile.min.css +2 -0
- data/assets/_vendor/tinymce/themes/inlite/index.js +7 -0
- data/assets/_vendor/tinymce/themes/inlite/theme.js +18787 -0
- data/assets/_vendor/tinymce/themes/inlite/theme.min.js +5 -0
- data/assets/_vendor/tinymce/themes/mobile/index.js +7 -0
- data/assets/_vendor/tinymce/themes/mobile/theme.js +23384 -0
- data/assets/_vendor/tinymce/themes/mobile/theme.min.js +8 -0
- data/assets/_vendor/tinymce/themes/modern/index.js +7 -0
- data/assets/_vendor/tinymce/themes/modern/theme.js +18311 -0
- data/assets/_vendor/tinymce/themes/modern/theme.min.js +5 -0
- data/assets/_vendor/tinymce/tinymce.js +44399 -0
- data/assets/bedrock/js/bedrock.js +16587 -6193
- data/assets/bedrock/scss/_bedrock-components.scss +16 -0
- data/assets/bedrock/scss/_bedrock-settings.scss +15 -0
- data/assets/bedrock/scss/components/attachments-grid.scss +138 -0
- data/assets/bedrock/scss/components/dropzone-upload.scss +158 -0
- data/assets/bedrock/scss/components/global.scss +16 -8
- data/assets/bedrock/scss/components/helper-classes.scss +59 -0
- data/assets/bedrock/scss/components/inline-edit-box.scss +80 -0
- data/assets/bedrock/scss/components/login-box.scss +48 -0
- data/assets/bedrock/scss/components/no-content.scss +31 -0
- data/assets/bedrock/scss/components/off-canvas-menu.scss +1 -1
- data/assets/bedrock/scss/components/page-content.scss +51 -0
- data/assets/bedrock/scss/components/reveal-panel.scss +89 -0
- data/assets/bedrock/scss/components/select-box.scss +332 -0
- data/assets/bedrock/scss/components/tiny-mce-editor.scss +14 -7
- data/lib/bedrock_sass.rb +6 -0
- data/lib/bedrock_sass/engine.rb +8 -0
- data/lib/bedrock_sass/version.rb +1 -1
- data/lib/tasks/before_assets_precompile.rake +11 -0
- metadata +188 -2
@@ -0,0 +1 @@
|
|
1
|
+
!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e[f]=d(a[f]);b.apply(null,e)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("3",tinymce.util.Tools.resolve),g("1",["3"],function(a){return a("tinymce.PluginManager")}),g("4",["3"],function(a){return a("tinymce.dom.DOMUtils")}),g("5",["3"],function(a){return a("tinymce.util.Tools")}),g("6",[],function(){var a=["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","FFFFFF","White","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum"],b=function(b){return b.getParam("textcolor_map",a)},c=function(a){return a.getParam("forecolor_map",b(a))},d=function(a){return a.getParam("backcolor_map",b(a))},e=function(a){return a.getParam("textcolor_rows",5)},f=function(a){return a.getParam("textcolor_cols",8)},g=function(a){return a.getParam("forecolor_rows",e(a))},h=function(a){return a.getParam("backcolor_rows",e(a))},i=function(a){return a.getParam("forecolor_cols",f(a))},j=function(a){return a.getParam("backcolor_cols",f(a))},k=function(a){return a.getParam("color_picker_callback",null)},l=function(a){return"function"==typeof k(a)};return{getForeColorMap:c,getBackColorMap:d,getForeColorRows:g,getBackColorRows:h,getForeColorCols:i,getBackColorCols:j,getColorPickerCallback:k,hasColorPicker:l}}),g("7",[],function(){var a=function(a,b){var c;return a.dom.getParents(a.selection.getStart(),function(a){var d;(d=a.style["forecolor"===b?"color":"background-color"])&&(c=d)}),c},b=function(a){var b,c=[];for(b=0;b<a.length;b+=2)c.push({text:a[b+1],color:"#"+a[b]});return c},c=function(a,b,c){a.undoManager.transact(function(){a.focus(),a.formatter.apply(b,{value:c}),a.nodeChanged()})},d=function(a,b){a.undoManager.transact(function(){a.focus(),a.formatter.remove(b,{value:null},null,!0),a.nodeChanged()})};return{getCurrentColor:a,mapColors:b,applyFormat:c,removeFormat:d}}),g("9",["3"],function(a){return a("tinymce.util.I18n")}),g("8",["4","9","6","7"],function(a,b,c,d){var e=function(c,e,f,g){var h,i,j,k,l,m,n,o=0,p=a.DOM.uniqueId("mcearia"),q=function(a,c){var d="transparent"===a;return'<td class="mce-grid-cell'+(d?" mce-colorbtn-trans":"")+'"><div id="'+p+"-"+o++ +'" data-mce-color="'+(a?a:"")+'" role="option" tabIndex="-1" style="'+(a?"background-color: "+a:"")+'" title="'+b.translate(c)+'">'+(d?"×":"")+"</div></td>"};for(h=d.mapColors(f),h.push({text:b.translate("No color"),color:"transparent"}),j='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>',k=h.length-1,m=0;m<e;m++){for(j+="<tr>",l=0;l<c;l++)n=m*c+l,n>k?j+="<td></td>":(i=h[n],j+=q(i.color,i.text));j+="</tr>"}if(g){for(j+='<tr><td colspan="'+c+'" class="mce-custom-color-btn"><div id="'+p+'-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" role="button" tabindex="-1" aria-labelledby="'+p+'-c" style="width: 100%"><button type="button" role="presentation" tabindex="-1">'+b.translate("Custom...")+"</button></div></td></tr>",j+="<tr>",l=0;l<c;l++)j+=q("","Custom color");j+="</tr>"}return j+="</tbody></table>"};return{getHtml:e}}),g("2",["4","5","6","7","8"],function(a,b,c,d,e){var f=function(a,b){a.style.background=b,a.setAttribute("data-mce-color",b)},g=function(a){return function(b){var c=b.control;c._color?d.applyFormat(a,c.settings.format,c._color):d.removeFormat(a,c.settings.format)}},h=function(e,g){return function(h){var i,j=this.parent(),k=d.getCurrentColor(e,j.settings.format),l=function(a){j.hidePanel(),j.color(a),d.applyFormat(e,j.settings.format,a)},m=function(){j.hidePanel(),j.resetColor(),d.removeFormat(e,j.settings.format)};if(a.DOM.getParent(h.target,".mce-custom-color-btn")){j.hidePanel();var n=c.getColorPickerCallback(e);n.call(e,function(a){var c,d,e,h=j.panel.getEl().getElementsByTagName("table")[0];for(c=b.map(h.rows[h.rows.length-1].childNodes,function(a){return a.firstChild}),e=0;e<c.length&&(d=c[e],d.getAttribute("data-mce-color"));e++);if(e===g)for(e=0;e<g-1;e++)f(c[e],c[e+1].getAttribute("data-mce-color"));f(d,a),l(a)},k)}i=h.target.getAttribute("data-mce-color"),i?(this.lastId&&a.DOM.get(this.lastId).setAttribute("aria-selected",!1),h.target.setAttribute("aria-selected",!0),this.lastId=h.target.id,"transparent"===i?m():l(i)):null!==i&&j.hidePanel()}},i=function(a,b){return function(){var d=b?c.getForeColorCols(a):c.getBackColorCols(a),f=b?c.getForeColorRows(a):c.getBackColorRows(a),g=b?c.getForeColorMap(a):c.getBackColorMap(a),h=c.hasColorPicker(a);return e.getHtml(d,f,g,h)}},j=function(a){a.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",format:"forecolor",panel:{role:"application",ariaRemember:!0,html:i(a,!0),onclick:h(a,c.getForeColorCols(a))},onclick:g(a)}),a.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",format:"hilitecolor",panel:{role:"application",ariaRemember:!0,html:i(a,!1),onclick:h(a,c.getBackColorCols(a))},onclick:g(a)})};return{register:j}}),g("0",["1","2"],function(a,b){return a.add("textcolor",function(a){b.register(a)}),function(){}}),d("0")()}();
|
@@ -0,0 +1,718 @@
|
|
1
|
+
(function () {
|
2
|
+
|
3
|
+
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
|
4
|
+
|
5
|
+
// Used when there is no 'main' module.
|
6
|
+
// The name is probably (hopefully) unique so minification removes for releases.
|
7
|
+
var register_3795 = function (id) {
|
8
|
+
var module = dem(id);
|
9
|
+
var fragments = id.split('.');
|
10
|
+
var target = Function('return this;')();
|
11
|
+
for (var i = 0; i < fragments.length - 1; ++i) {
|
12
|
+
if (target[fragments[i]] === undefined)
|
13
|
+
target[fragments[i]] = {};
|
14
|
+
target = target[fragments[i]];
|
15
|
+
}
|
16
|
+
target[fragments[fragments.length - 1]] = module;
|
17
|
+
};
|
18
|
+
|
19
|
+
var instantiate = function (id) {
|
20
|
+
var actual = defs[id];
|
21
|
+
var dependencies = actual.deps;
|
22
|
+
var definition = actual.defn;
|
23
|
+
var len = dependencies.length;
|
24
|
+
var instances = new Array(len);
|
25
|
+
for (var i = 0; i < len; ++i)
|
26
|
+
instances[i] = dem(dependencies[i]);
|
27
|
+
var defResult = definition.apply(null, instances);
|
28
|
+
if (defResult === undefined)
|
29
|
+
throw 'module [' + id + '] returned undefined';
|
30
|
+
actual.instance = defResult;
|
31
|
+
};
|
32
|
+
|
33
|
+
var def = function (id, dependencies, definition) {
|
34
|
+
if (typeof id !== 'string')
|
35
|
+
throw 'module id must be a string';
|
36
|
+
else if (dependencies === undefined)
|
37
|
+
throw 'no dependencies for ' + id;
|
38
|
+
else if (definition === undefined)
|
39
|
+
throw 'no definition function for ' + id;
|
40
|
+
defs[id] = {
|
41
|
+
deps: dependencies,
|
42
|
+
defn: definition,
|
43
|
+
instance: undefined
|
44
|
+
};
|
45
|
+
};
|
46
|
+
|
47
|
+
var dem = function (id) {
|
48
|
+
var actual = defs[id];
|
49
|
+
if (actual === undefined)
|
50
|
+
throw 'module [' + id + '] was undefined';
|
51
|
+
else if (actual.instance === undefined)
|
52
|
+
instantiate(id);
|
53
|
+
return actual.instance;
|
54
|
+
};
|
55
|
+
|
56
|
+
var req = function (ids, callback) {
|
57
|
+
var len = ids.length;
|
58
|
+
var instances = new Array(len);
|
59
|
+
for (var i = 0; i < len; ++i)
|
60
|
+
instances[i] = dem(ids[i]);
|
61
|
+
callback.apply(null, instances);
|
62
|
+
};
|
63
|
+
|
64
|
+
var ephox = {};
|
65
|
+
|
66
|
+
ephox.bolt = {
|
67
|
+
module: {
|
68
|
+
api: {
|
69
|
+
define: def,
|
70
|
+
require: req,
|
71
|
+
demand: dem
|
72
|
+
}
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
var define = def;
|
77
|
+
var require = req;
|
78
|
+
var demand = dem;
|
79
|
+
// this helps with minification when using a lot of global references
|
80
|
+
var defineGlobal = function (id, ref) {
|
81
|
+
define(id, [], function () { return ref; });
|
82
|
+
};
|
83
|
+
/*jsc
|
84
|
+
["tinymce.plugins.textpattern.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.textpattern.api.Api","tinymce.plugins.textpattern.api.Settings","tinymce.plugins.textpattern.core.Keyboard","global!tinymce.util.Tools.resolve","tinymce.core.util.Delay","tinymce.core.util.VK","tinymce.plugins.textpattern.core.KeyHandler","tinymce.plugins.textpattern.core.Formatter","global!document","tinymce.core.dom.TreeWalker","tinymce.core.util.Tools","tinymce.plugins.textpattern.core.Patterns"]
|
85
|
+
jsc*/
|
86
|
+
define(
|
87
|
+
'ephox.katamari.api.Cell',
|
88
|
+
|
89
|
+
[
|
90
|
+
],
|
91
|
+
|
92
|
+
function () {
|
93
|
+
var Cell = function (initial) {
|
94
|
+
var value = initial;
|
95
|
+
|
96
|
+
var get = function () {
|
97
|
+
return value;
|
98
|
+
};
|
99
|
+
|
100
|
+
var set = function (v) {
|
101
|
+
value = v;
|
102
|
+
};
|
103
|
+
|
104
|
+
var clone = function () {
|
105
|
+
return Cell(get());
|
106
|
+
};
|
107
|
+
|
108
|
+
return {
|
109
|
+
get: get,
|
110
|
+
set: set,
|
111
|
+
clone: clone
|
112
|
+
};
|
113
|
+
};
|
114
|
+
|
115
|
+
return Cell;
|
116
|
+
}
|
117
|
+
);
|
118
|
+
|
119
|
+
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
|
120
|
+
/**
|
121
|
+
* ResolveGlobal.js
|
122
|
+
*
|
123
|
+
* Released under LGPL License.
|
124
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
125
|
+
*
|
126
|
+
* License: http://www.tinymce.com/license
|
127
|
+
* Contributing: http://www.tinymce.com/contributing
|
128
|
+
*/
|
129
|
+
|
130
|
+
define(
|
131
|
+
'tinymce.core.PluginManager',
|
132
|
+
[
|
133
|
+
'global!tinymce.util.Tools.resolve'
|
134
|
+
],
|
135
|
+
function (resolve) {
|
136
|
+
return resolve('tinymce.PluginManager');
|
137
|
+
}
|
138
|
+
);
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Api.js
|
142
|
+
*
|
143
|
+
* Released under LGPL License.
|
144
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
145
|
+
*
|
146
|
+
* License: http://www.tinymce.com/license
|
147
|
+
* Contributing: http://www.tinymce.com/contributing
|
148
|
+
*/
|
149
|
+
|
150
|
+
define(
|
151
|
+
'tinymce.plugins.textpattern.api.Api',
|
152
|
+
[
|
153
|
+
],
|
154
|
+
function () {
|
155
|
+
var get = function (patternsState) {
|
156
|
+
var setPatterns = function (newPatterns) {
|
157
|
+
patternsState.set(newPatterns);
|
158
|
+
};
|
159
|
+
|
160
|
+
var getPatterns = function () {
|
161
|
+
return patternsState.get();
|
162
|
+
};
|
163
|
+
|
164
|
+
return {
|
165
|
+
setPatterns: setPatterns,
|
166
|
+
getPatterns: getPatterns
|
167
|
+
};
|
168
|
+
};
|
169
|
+
|
170
|
+
return {
|
171
|
+
get: get
|
172
|
+
};
|
173
|
+
}
|
174
|
+
);
|
175
|
+
/**
|
176
|
+
* Settings.js
|
177
|
+
*
|
178
|
+
* Released under LGPL License.
|
179
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
180
|
+
*
|
181
|
+
* License: http://www.tinymce.com/license
|
182
|
+
* Contributing: http://www.tinymce.com/contributing
|
183
|
+
*/
|
184
|
+
|
185
|
+
define(
|
186
|
+
'tinymce.plugins.textpattern.api.Settings',
|
187
|
+
[
|
188
|
+
],
|
189
|
+
function () {
|
190
|
+
var defaultPatterns = [
|
191
|
+
{ start: '*', end: '*', format: 'italic' },
|
192
|
+
{ start: '**', end: '**', format: 'bold' },
|
193
|
+
{ start: '***', end: '***', format: ['bold', 'italic'] },
|
194
|
+
{ start: '#', format: 'h1' },
|
195
|
+
{ start: '##', format: 'h2' },
|
196
|
+
{ start: '###', format: 'h3' },
|
197
|
+
{ start: '####', format: 'h4' },
|
198
|
+
{ start: '#####', format: 'h5' },
|
199
|
+
{ start: '######', format: 'h6' },
|
200
|
+
{ start: '1. ', cmd: 'InsertOrderedList' },
|
201
|
+
{ start: '* ', cmd: 'InsertUnorderedList' },
|
202
|
+
{ start: '- ', cmd: 'InsertUnorderedList' }
|
203
|
+
];
|
204
|
+
|
205
|
+
var getPatterns = function (editorSettings) {
|
206
|
+
return editorSettings.textpattern_patterns !== undefined ?
|
207
|
+
editorSettings.textpattern_patterns :
|
208
|
+
defaultPatterns;
|
209
|
+
};
|
210
|
+
|
211
|
+
return {
|
212
|
+
getPatterns: getPatterns
|
213
|
+
};
|
214
|
+
}
|
215
|
+
);
|
216
|
+
|
217
|
+
/**
|
218
|
+
* ResolveGlobal.js
|
219
|
+
*
|
220
|
+
* Released under LGPL License.
|
221
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
222
|
+
*
|
223
|
+
* License: http://www.tinymce.com/license
|
224
|
+
* Contributing: http://www.tinymce.com/contributing
|
225
|
+
*/
|
226
|
+
|
227
|
+
define(
|
228
|
+
'tinymce.core.util.Delay',
|
229
|
+
[
|
230
|
+
'global!tinymce.util.Tools.resolve'
|
231
|
+
],
|
232
|
+
function (resolve) {
|
233
|
+
return resolve('tinymce.util.Delay');
|
234
|
+
}
|
235
|
+
);
|
236
|
+
|
237
|
+
/**
|
238
|
+
* ResolveGlobal.js
|
239
|
+
*
|
240
|
+
* Released under LGPL License.
|
241
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
242
|
+
*
|
243
|
+
* License: http://www.tinymce.com/license
|
244
|
+
* Contributing: http://www.tinymce.com/contributing
|
245
|
+
*/
|
246
|
+
|
247
|
+
define(
|
248
|
+
'tinymce.core.util.VK',
|
249
|
+
[
|
250
|
+
'global!tinymce.util.Tools.resolve'
|
251
|
+
],
|
252
|
+
function (resolve) {
|
253
|
+
return resolve('tinymce.util.VK');
|
254
|
+
}
|
255
|
+
);
|
256
|
+
|
257
|
+
defineGlobal("global!document", document);
|
258
|
+
/**
|
259
|
+
* ResolveGlobal.js
|
260
|
+
*
|
261
|
+
* Released under LGPL License.
|
262
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
263
|
+
*
|
264
|
+
* License: http://www.tinymce.com/license
|
265
|
+
* Contributing: http://www.tinymce.com/contributing
|
266
|
+
*/
|
267
|
+
|
268
|
+
define(
|
269
|
+
'tinymce.core.dom.TreeWalker',
|
270
|
+
[
|
271
|
+
'global!tinymce.util.Tools.resolve'
|
272
|
+
],
|
273
|
+
function (resolve) {
|
274
|
+
return resolve('tinymce.dom.TreeWalker');
|
275
|
+
}
|
276
|
+
);
|
277
|
+
|
278
|
+
/**
|
279
|
+
* ResolveGlobal.js
|
280
|
+
*
|
281
|
+
* Released under LGPL License.
|
282
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
283
|
+
*
|
284
|
+
* License: http://www.tinymce.com/license
|
285
|
+
* Contributing: http://www.tinymce.com/contributing
|
286
|
+
*/
|
287
|
+
|
288
|
+
define(
|
289
|
+
'tinymce.core.util.Tools',
|
290
|
+
[
|
291
|
+
'global!tinymce.util.Tools.resolve'
|
292
|
+
],
|
293
|
+
function (resolve) {
|
294
|
+
return resolve('tinymce.util.Tools');
|
295
|
+
}
|
296
|
+
);
|
297
|
+
|
298
|
+
/**
|
299
|
+
* Patterns.js
|
300
|
+
*
|
301
|
+
* Released under LGPL License.
|
302
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
303
|
+
*
|
304
|
+
* License: http://www.tinymce.com/license
|
305
|
+
* Contributing: http://www.tinymce.com/contributing
|
306
|
+
*/
|
307
|
+
|
308
|
+
define(
|
309
|
+
'tinymce.plugins.textpattern.core.Patterns',
|
310
|
+
[
|
311
|
+
],
|
312
|
+
function () {
|
313
|
+
// Returns a sorted patterns list, ordered descending by start length
|
314
|
+
var sortPatterns = function (patterns) {
|
315
|
+
return patterns.sort(function (a, b) {
|
316
|
+
if (a.start.length > b.start.length) {
|
317
|
+
return -1;
|
318
|
+
}
|
319
|
+
|
320
|
+
if (a.start.length < b.start.length) {
|
321
|
+
return 1;
|
322
|
+
}
|
323
|
+
|
324
|
+
return 0;
|
325
|
+
});
|
326
|
+
};
|
327
|
+
|
328
|
+
// Finds a matching pattern to the specified text
|
329
|
+
var findPattern = function (patterns, text) {
|
330
|
+
for (var i = 0; i < patterns.length; i++) {
|
331
|
+
if (text.indexOf(patterns[i].start) !== 0) {
|
332
|
+
continue;
|
333
|
+
}
|
334
|
+
|
335
|
+
if (patterns[i].end && text.lastIndexOf(patterns[i].end) !== (text.length - patterns[i].end.length)) {
|
336
|
+
continue;
|
337
|
+
}
|
338
|
+
|
339
|
+
return patterns[i];
|
340
|
+
}
|
341
|
+
};
|
342
|
+
|
343
|
+
var isMatchingPattern = function (pattern, text, offset, delta) {
|
344
|
+
var textEnd = text.substr(offset - pattern.end.length - delta, pattern.end.length);
|
345
|
+
return textEnd === pattern.end;
|
346
|
+
};
|
347
|
+
|
348
|
+
var hasContent = function (offset, delta, pattern) {
|
349
|
+
return (offset - delta - pattern.end.length - pattern.start.length) > 0;
|
350
|
+
};
|
351
|
+
|
352
|
+
// Finds the best matching end pattern
|
353
|
+
var findEndPattern = function (patterns, text, offset, delta) {
|
354
|
+
var pattern, i;
|
355
|
+
var sortedPatterns = sortPatterns(patterns);
|
356
|
+
|
357
|
+
// Find best matching end
|
358
|
+
for (i = 0; i < sortedPatterns.length; i++) {
|
359
|
+
pattern = sortedPatterns[i];
|
360
|
+
if (pattern.end !== undefined && isMatchingPattern(pattern, text, offset, delta) && hasContent(offset, delta, pattern)) {
|
361
|
+
return pattern;
|
362
|
+
}
|
363
|
+
}
|
364
|
+
};
|
365
|
+
|
366
|
+
return {
|
367
|
+
findPattern: findPattern,
|
368
|
+
findEndPattern: findEndPattern
|
369
|
+
};
|
370
|
+
}
|
371
|
+
);
|
372
|
+
|
373
|
+
/**
|
374
|
+
* Formatter.js
|
375
|
+
*
|
376
|
+
* Released under LGPL License.
|
377
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
378
|
+
*
|
379
|
+
* License: http://www.tinymce.com/license
|
380
|
+
* Contributing: http://www.tinymce.com/contributing
|
381
|
+
*/
|
382
|
+
|
383
|
+
define(
|
384
|
+
'tinymce.plugins.textpattern.core.Formatter',
|
385
|
+
[
|
386
|
+
'global!document',
|
387
|
+
'tinymce.core.dom.TreeWalker',
|
388
|
+
'tinymce.core.util.Tools',
|
389
|
+
'tinymce.plugins.textpattern.core.Patterns'
|
390
|
+
],
|
391
|
+
function (document, TreeWalker, Tools, Patterns) {
|
392
|
+
var splitContainer = function (container, pattern, endOffset, startOffset, space) {
|
393
|
+
|
394
|
+
// Split text node and remove start/end from text node
|
395
|
+
container = startOffset > 0 ? container.splitText(startOffset) : container;
|
396
|
+
container.splitText(endOffset - startOffset + pattern.end.length);
|
397
|
+
container.deleteData(0, pattern.start.length);
|
398
|
+
container.deleteData(container.data.length - pattern.end.length, pattern.end.length);
|
399
|
+
|
400
|
+
return container;
|
401
|
+
};
|
402
|
+
|
403
|
+
var patternFromRng = function (patterns, rng, space) {
|
404
|
+
if (rng.collapsed === false) {
|
405
|
+
return;
|
406
|
+
}
|
407
|
+
|
408
|
+
var container = rng.startContainer;
|
409
|
+
var text = container.data;
|
410
|
+
var delta = space === true ? 1 : 0;
|
411
|
+
|
412
|
+
if (container.nodeType !== 3) {
|
413
|
+
return;
|
414
|
+
}
|
415
|
+
|
416
|
+
// Find best matching end
|
417
|
+
var endPattern = Patterns.findEndPattern(patterns, text, rng.startOffset, delta);
|
418
|
+
if (endPattern === undefined) {
|
419
|
+
return;
|
420
|
+
}
|
421
|
+
|
422
|
+
// Find start of matched pattern
|
423
|
+
var endOffset = text.lastIndexOf(endPattern.end, rng.startOffset - delta);
|
424
|
+
var startOffset = text.lastIndexOf(endPattern.start, endOffset - endPattern.end.length);
|
425
|
+
endOffset = text.indexOf(endPattern.end, startOffset + endPattern.start.length);
|
426
|
+
|
427
|
+
if (startOffset === -1) {
|
428
|
+
return;
|
429
|
+
}
|
430
|
+
|
431
|
+
// Setup a range for the matching word
|
432
|
+
var patternRng = document.createRange();
|
433
|
+
patternRng.setStart(container, startOffset);
|
434
|
+
patternRng.setEnd(container, endOffset + endPattern.end.length);
|
435
|
+
|
436
|
+
var startPattern = Patterns.findPattern(patterns, patternRng.toString());
|
437
|
+
|
438
|
+
if (endPattern === undefined || startPattern !== endPattern || (container.data.length <= endPattern.start.length + endPattern.end.length)) {
|
439
|
+
return;
|
440
|
+
}
|
441
|
+
|
442
|
+
return {
|
443
|
+
pattern: endPattern,
|
444
|
+
startOffset: startOffset,
|
445
|
+
endOffset: endOffset
|
446
|
+
};
|
447
|
+
};
|
448
|
+
|
449
|
+
var splitAndApply = function (editor, container, found, space) {
|
450
|
+
var formatArray = Tools.isArray(found.pattern.format) ? found.pattern.format : [found.pattern.format];
|
451
|
+
var validFormats = Tools.grep(formatArray, function (formatName) {
|
452
|
+
var format = editor.formatter.get(formatName);
|
453
|
+
return format && format[0].inline;
|
454
|
+
});
|
455
|
+
|
456
|
+
if (validFormats.length !== 0) {
|
457
|
+
editor.undoManager.transact(function () {
|
458
|
+
container = splitContainer(container, found.pattern, found.endOffset, found.startOffset, space);
|
459
|
+
formatArray.forEach(function (format) {
|
460
|
+
editor.formatter.apply(format, {}, container);
|
461
|
+
});
|
462
|
+
});
|
463
|
+
|
464
|
+
return container;
|
465
|
+
}
|
466
|
+
};
|
467
|
+
|
468
|
+
// Handles inline formats like *abc* and **abc**
|
469
|
+
var doApplyInlineFormat = function (editor, patterns, space) {
|
470
|
+
var rng = editor.selection.getRng(true);
|
471
|
+
var foundPattern = patternFromRng(patterns, rng, space);
|
472
|
+
|
473
|
+
if (foundPattern) {
|
474
|
+
return splitAndApply(editor, rng.startContainer, foundPattern, space);
|
475
|
+
}
|
476
|
+
};
|
477
|
+
|
478
|
+
var applyInlineFormatSpace = function (editor, patterns) {
|
479
|
+
return doApplyInlineFormat(editor, patterns, true);
|
480
|
+
};
|
481
|
+
var applyInlineFormatEnter = function (editor, patterns) {
|
482
|
+
return doApplyInlineFormat(editor, patterns, false);
|
483
|
+
};
|
484
|
+
|
485
|
+
// Handles block formats like ##abc or 1. abc
|
486
|
+
var applyBlockFormat = function (editor, patterns) {
|
487
|
+
var selection, dom, container, firstTextNode, node, format, textBlockElm, pattern, walker, rng, offset;
|
488
|
+
|
489
|
+
selection = editor.selection;
|
490
|
+
dom = editor.dom;
|
491
|
+
|
492
|
+
if (!selection.isCollapsed()) {
|
493
|
+
return;
|
494
|
+
}
|
495
|
+
|
496
|
+
textBlockElm = dom.getParent(selection.getStart(), 'p');
|
497
|
+
if (textBlockElm) {
|
498
|
+
walker = new TreeWalker(textBlockElm, textBlockElm);
|
499
|
+
while ((node = walker.next())) {
|
500
|
+
if (node.nodeType === 3) {
|
501
|
+
firstTextNode = node;
|
502
|
+
break;
|
503
|
+
}
|
504
|
+
}
|
505
|
+
|
506
|
+
if (firstTextNode) {
|
507
|
+
pattern = Patterns.findPattern(patterns, firstTextNode.data);
|
508
|
+
if (!pattern) {
|
509
|
+
return;
|
510
|
+
}
|
511
|
+
|
512
|
+
rng = selection.getRng(true);
|
513
|
+
container = rng.startContainer;
|
514
|
+
offset = rng.startOffset;
|
515
|
+
|
516
|
+
if (firstTextNode === container) {
|
517
|
+
offset = Math.max(0, offset - pattern.start.length);
|
518
|
+
}
|
519
|
+
|
520
|
+
if (Tools.trim(firstTextNode.data).length === pattern.start.length) {
|
521
|
+
return;
|
522
|
+
}
|
523
|
+
|
524
|
+
if (pattern.format) {
|
525
|
+
format = editor.formatter.get(pattern.format);
|
526
|
+
if (format && format[0].block) {
|
527
|
+
firstTextNode.deleteData(0, pattern.start.length);
|
528
|
+
editor.formatter.apply(pattern.format, {}, firstTextNode);
|
529
|
+
|
530
|
+
rng.setStart(container, offset);
|
531
|
+
rng.collapse(true);
|
532
|
+
selection.setRng(rng);
|
533
|
+
}
|
534
|
+
}
|
535
|
+
|
536
|
+
if (pattern.cmd) {
|
537
|
+
editor.undoManager.transact(function () {
|
538
|
+
firstTextNode.deleteData(0, pattern.start.length);
|
539
|
+
editor.execCommand(pattern.cmd);
|
540
|
+
});
|
541
|
+
}
|
542
|
+
}
|
543
|
+
}
|
544
|
+
};
|
545
|
+
|
546
|
+
return {
|
547
|
+
patternFromRng: patternFromRng,
|
548
|
+
applyInlineFormatSpace: applyInlineFormatSpace,
|
549
|
+
applyInlineFormatEnter: applyInlineFormatEnter,
|
550
|
+
applyBlockFormat: applyBlockFormat
|
551
|
+
};
|
552
|
+
}
|
553
|
+
);
|
554
|
+
|
555
|
+
/**
|
556
|
+
* KeyHandler.js
|
557
|
+
*
|
558
|
+
* Released under LGPL License.
|
559
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
560
|
+
*
|
561
|
+
* License: http://www.tinymce.com/license
|
562
|
+
* Contributing: http://www.tinymce.com/contributing
|
563
|
+
*/
|
564
|
+
|
565
|
+
define(
|
566
|
+
'tinymce.plugins.textpattern.core.KeyHandler',
|
567
|
+
[
|
568
|
+
'tinymce.core.util.VK',
|
569
|
+
'tinymce.plugins.textpattern.core.Formatter'
|
570
|
+
],
|
571
|
+
function (VK, Formatter) {
|
572
|
+
function handleEnter(editor, patterns) {
|
573
|
+
var wrappedTextNode, rng;
|
574
|
+
|
575
|
+
wrappedTextNode = Formatter.applyInlineFormatEnter(editor, patterns);
|
576
|
+
if (wrappedTextNode) {
|
577
|
+
rng = editor.dom.createRng();
|
578
|
+
rng.setStart(wrappedTextNode, wrappedTextNode.data.length);
|
579
|
+
rng.setEnd(wrappedTextNode, wrappedTextNode.data.length);
|
580
|
+
editor.selection.setRng(rng);
|
581
|
+
}
|
582
|
+
|
583
|
+
Formatter.applyBlockFormat(editor, patterns);
|
584
|
+
}
|
585
|
+
|
586
|
+
function handleInlineKey(editor, patterns) {
|
587
|
+
var wrappedTextNode, lastChar, lastCharNode, rng, dom;
|
588
|
+
|
589
|
+
wrappedTextNode = Formatter.applyInlineFormatSpace(editor, patterns);
|
590
|
+
if (wrappedTextNode) {
|
591
|
+
dom = editor.dom;
|
592
|
+
lastChar = wrappedTextNode.data.slice(-1);
|
593
|
+
|
594
|
+
// Move space after the newly formatted node
|
595
|
+
if (/[\u00a0 ]/.test(lastChar)) {
|
596
|
+
wrappedTextNode.deleteData(wrappedTextNode.data.length - 1, 1);
|
597
|
+
lastCharNode = dom.doc.createTextNode(lastChar);
|
598
|
+
|
599
|
+
dom.insertAfter(lastCharNode, wrappedTextNode.parentNode);
|
600
|
+
|
601
|
+
rng = dom.createRng();
|
602
|
+
rng.setStart(lastCharNode, 1);
|
603
|
+
rng.setEnd(lastCharNode, 1);
|
604
|
+
editor.selection.setRng(rng);
|
605
|
+
}
|
606
|
+
}
|
607
|
+
}
|
608
|
+
|
609
|
+
var checkKeyEvent = function (codes, event, predicate) {
|
610
|
+
for (var i = 0; i < codes.length; i++) {
|
611
|
+
if (predicate(codes[i], event)) {
|
612
|
+
return true;
|
613
|
+
}
|
614
|
+
}
|
615
|
+
};
|
616
|
+
|
617
|
+
var checkKeyCode = function (codes, event) {
|
618
|
+
return checkKeyEvent(codes, event, function (code, event) {
|
619
|
+
return code === event.keyCode && VK.modifierPressed(event) === false;
|
620
|
+
});
|
621
|
+
};
|
622
|
+
|
623
|
+
var checkCharCode = function (chars, event) {
|
624
|
+
return checkKeyEvent(chars, event, function (chr, event) {
|
625
|
+
return chr.charCodeAt(0) === event.charCode;
|
626
|
+
});
|
627
|
+
};
|
628
|
+
|
629
|
+
return {
|
630
|
+
handleEnter: handleEnter,
|
631
|
+
handleInlineKey: handleInlineKey,
|
632
|
+
checkCharCode: checkCharCode,
|
633
|
+
checkKeyCode: checkKeyCode
|
634
|
+
};
|
635
|
+
}
|
636
|
+
);
|
637
|
+
|
638
|
+
/**
|
639
|
+
* Keyboard.js
|
640
|
+
*
|
641
|
+
* Released under LGPL License.
|
642
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
643
|
+
*
|
644
|
+
* License: http://www.tinymce.com/license
|
645
|
+
* Contributing: http://www.tinymce.com/contributing
|
646
|
+
*/
|
647
|
+
|
648
|
+
define(
|
649
|
+
'tinymce.plugins.textpattern.core.Keyboard',
|
650
|
+
[
|
651
|
+
'tinymce.core.util.Delay',
|
652
|
+
'tinymce.core.util.VK',
|
653
|
+
'tinymce.plugins.textpattern.core.KeyHandler'
|
654
|
+
],
|
655
|
+
function (Delay, VK, KeyHandler) {
|
656
|
+
var setup = function (editor, patternsState) {
|
657
|
+
var charCodes = [',', '.', ';', ':', '!', '?'];
|
658
|
+
var keyCodes = [32];
|
659
|
+
|
660
|
+
editor.on('keydown', function (e) {
|
661
|
+
if (e.keyCode === 13 && !VK.modifierPressed(e)) {
|
662
|
+
KeyHandler.handleEnter(editor, patternsState.get());
|
663
|
+
}
|
664
|
+
}, true);
|
665
|
+
|
666
|
+
editor.on('keyup', function (e) {
|
667
|
+
if (KeyHandler.checkKeyCode(keyCodes, e)) {
|
668
|
+
KeyHandler.handleInlineKey(editor, patternsState.get());
|
669
|
+
}
|
670
|
+
});
|
671
|
+
|
672
|
+
editor.on('keypress', function (e) {
|
673
|
+
if (KeyHandler.checkCharCode(charCodes, e)) {
|
674
|
+
Delay.setEditorTimeout(editor, function () {
|
675
|
+
KeyHandler.handleInlineKey(editor, patternsState.get());
|
676
|
+
});
|
677
|
+
}
|
678
|
+
});
|
679
|
+
};
|
680
|
+
|
681
|
+
return {
|
682
|
+
setup: setup
|
683
|
+
};
|
684
|
+
}
|
685
|
+
);
|
686
|
+
/**
|
687
|
+
* Plugin.js
|
688
|
+
*
|
689
|
+
* Released under LGPL License.
|
690
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
691
|
+
*
|
692
|
+
* License: http://www.tinymce.com/license
|
693
|
+
* Contributing: http://www.tinymce.com/contributing
|
694
|
+
*/
|
695
|
+
|
696
|
+
define(
|
697
|
+
'tinymce.plugins.textpattern.Plugin',
|
698
|
+
[
|
699
|
+
'ephox.katamari.api.Cell',
|
700
|
+
'tinymce.core.PluginManager',
|
701
|
+
'tinymce.plugins.textpattern.api.Api',
|
702
|
+
'tinymce.plugins.textpattern.api.Settings',
|
703
|
+
'tinymce.plugins.textpattern.core.Keyboard'
|
704
|
+
],
|
705
|
+
function (Cell, PluginManager, Api, Settings, Keyboard) {
|
706
|
+
PluginManager.add('textpattern', function (editor) {
|
707
|
+
var patternsState = Cell(Settings.getPatterns(editor.settings));
|
708
|
+
|
709
|
+
Keyboard.setup(editor, patternsState);
|
710
|
+
|
711
|
+
return Api.get(patternsState);
|
712
|
+
});
|
713
|
+
|
714
|
+
return function () { };
|
715
|
+
}
|
716
|
+
);
|
717
|
+
dem('tinymce.plugins.textpattern.Plugin')();
|
718
|
+
})();
|