diff --git a/tinymce4.x/footnotes/plugin.js b/tinymce4.x/footnotes/plugin.js index cfbedf1..c131179 100644 --- a/tinymce4.x/footnotes/plugin.js +++ b/tinymce4.x/footnotes/plugin.js @@ -42,7 +42,7 @@ tinymce.PluginManager.add('footnotes', function(editor) { fixFootnoteContent = (function () { return encodeURIComponent(newfootnoteContent); }()), - htmlTemplate = '{FOOTNOTE_INDEX} ', + htmlTemplate = '{FOOTNOTE_INDEX} ', totalFootNote = editor.getDoc().querySelectorAll('.fnoteBtn'), totalCount = totalFootNote.length, html; diff --git a/tinymce4.x/footnotes/plugin.min.js b/tinymce4.x/footnotes/plugin.min.js index 9970316..6ca372d 100644 --- a/tinymce4.x/footnotes/plugin.min.js +++ b/tinymce4.x/footnotes/plugin.min.js @@ -1 +1 @@ -tinymce.PluginManager.add("footnotes",function(t){function n(t,n){var e=t;for(var o in n)e=e.replace("{"+o+"}",n[o]);return e}function e(){var e=t.selection.getNode(),o="",a="SPAN"==e.tagName&&"fnoteWrap"===t.dom.getAttrib(e,"class"),i=function(){if("fnoteWrap"==e.className){var t=e.childNodes[0].firstChild.nodeValue.replace(/[^0-9]/g,"");return t}return e.childNodes[0]}();a&&(o=e.name||decodeURIComponent(e.childNodes[0].getAttribute("data-content"))||""),t.windowManager.open({title:"Insert a contents",id:"footnote-dialog",body:{type:"textbox",name:"name",multiline:!0,minWidth:520,minHeight:100,value:o},onSubmit:function(e){function o(t){function n(t,n){for(var a=e(n);0!==a.length;){var i=o(t,a);if(null!==i)return i;a=e(a)}return a}function e(t){return t.nextAll().find(".fnoteBtn").length>0?t.next().hasClass("fnoteBtn")?t.next().children().children():t.nextAll().find(".fnoteBtn"):"BODY"==t.prop("nodeName")?[]:e(t.parent())}function o(t,n){if(!n)return!1;if(n)return n;var e=null;return n.children().each(function(){n&&(e=o(t,$(this)))}),e}var a=n(".fnoteBtn",t);return a}var a,r=e.data.name,l=function(){return encodeURIComponent(r)}(),c='{FOOTNOTE_INDEX} ',f=t.getDoc().querySelectorAll(".fnoteBtn"),s=f.length,d=o($(t.selection.getRng().endContainer));if(d.length){d=d[0];var u;for(u=0;s>u&&d!=f[u];u++);s>i?a=n(c,{FOOTNOTE_INDEX:$(f[i-1]).html()}):(a=n(c,{FOOTNOTE_INDEX:$(f[u]).html()}),t.selection.collapse(0))}else a=n(c,{FOOTNOTE_INDEX:s+1}),t.selection.collapse(0);t.execCommand("mceInsertContent",!1,a),$(t.getDoc()).find(".fnoteBtn").each(function(t){$(this).text(t+1),$(this).parent().attr("id","#wk_ft"+(t+1))})}})}t.addCommand("mceFootnotes",e),t.addButton("footnotes",{title:"footnote",image:tinyMCE.baseURL+"/plugins/footnotes/img/footnotes.png",onclick:e,stateSelector:"span.fnoteWrap"})}); \ No newline at end of file +tinymce.PluginManager.add("footnotes",function(t){function n(t,n){var e=t;for(var o in n)e=e.replace("{"+o+"}",n[o]);return e}function e(){var e=t.selection.getNode(),o="",a="SPAN"==e.tagName&&"fnoteWrap"===t.dom.getAttrib(e,"class"),i=function(){if("fnoteWrap"==e.className){var t=e.childNodes[0].firstChild.nodeValue.replace(/[^0-9]/g,"");return t}return e.childNodes[0]}();a&&(o=e.name||decodeURIComponent(e.childNodes[0].getAttribute("data-content"))||""),t.windowManager.open({title:"Insert a contents",id:"footnote-dialog",body:{type:"textbox",name:"name",multiline:!0,minWidth:520,minHeight:100,value:o},onSubmit:function(e){function o(t){function n(t,n){for(var a=e(n);0!==a.length;){var i=o(t,a);if(null!==i)return i;a=e(a)}return a}function e(t){return t.nextAll().find(".fnoteBtn").length>0?t.next().hasClass("fnoteBtn")?t.next().children().children():t.nextAll().find(".fnoteBtn"):"BODY"==t.prop("nodeName")?[]:e(t.parent())}function o(t,n){if(!n)return!1;if(n)return n;var e=null;return n.children().each(function(){n&&(e=o(t,$(this)))}),e}var a=n(".fnoteBtn",t);return a}var a,r=e.data.name,l=function(){return encodeURIComponent(r)}(),c='{FOOTNOTE_INDEX} ',f=t.getDoc().querySelectorAll(".fnoteBtn"),s=f.length,d=o($(t.selection.getRng().endContainer));if(d.length){d=d[0];var u;for(u=0;s>u&&d!=f[u];u++);s>i?a=n(c,{FOOTNOTE_INDEX:$(f[i-1]).html()}):(a=n(c,{FOOTNOTE_INDEX:$(f[u]).html()}),t.selection.collapse(0))}else a=n(c,{FOOTNOTE_INDEX:s+1}),t.selection.collapse(0);t.execCommand("mceInsertContent",!1,a),$(t.getDoc()).find(".fnoteBtn").each(function(t){$(this).text(t+1),$(this).parent().attr("id","#wk_ft"+(t+1))})}})}t.addCommand("mceFootnotes",e),t.addButton("footnotes",{title:"footnote",image:tinyMCE.baseURL+"/plugins/footnotes/img/footnotes.png",onclick:e,stateSelector:"span.fnoteWrap"})}); \ No newline at end of file