From 812ac9e4d4a3a7357c0a0fdfaf94f242a32fa0f6 Mon Sep 17 00:00:00 2001 From: minalkumar2893 <46880667+minalkumar2893@users.noreply.github.com> Date: Thu, 3 Jun 2021 11:57:03 +0530 Subject: [PATCH 1/2] show footnote as supersript and the content in the tooltip --- tinymce4.x/footnotes/plugin.js | 2 +- tinymce4.x/footnotes/plugin.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tinymce4.x/footnotes/plugin.js b/tinymce4.x/footnotes/plugin.js index 1e8dea7..cfbedf1 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 = ' ', + 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 f52c5ac..9970316 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=' ',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;u0?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 From beb73c5009bb5a33e439b6051507784e59b80ef1 Mon Sep 17 00:00:00 2001 From: minalkumar2893 <46880667+minalkumar2893@users.noreply.github.com> Date: Thu, 3 Jun 2021 22:18:39 +0530 Subject: [PATCH 2/2] encoded tooltip text issue --- tinymce4.x/footnotes/plugin.js | 2 +- tinymce4.x/footnotes/plugin.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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