Skip to content
Snippets Groups Projects
Commit 95b6cc36 authored by Scott Euser's avatar Scott Euser
Browse files

Remove unused code

parent 80d92e69
Branches 2.0.x
Tags 2.0.0
No related merge requests found
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.CKEditor5=t():(e.CKEditor5=e.CKEditor5||{},e.CKEditor5.footnotes=t())}(self,(()=>(()=>{var e={"ckeditor5/src/core.js":(e,t,o)=>{e.exports=o("dll-reference CKEditor5.dll")("./src/core.js")},"ckeditor5/src/engine.js":(e,t,o)=>{e.exports=o("dll-reference CKEditor5.dll")("./src/engine.js")},"ckeditor5/src/ui.js":(e,t,o)=>{e.exports=o("dll-reference CKEditor5.dll")("./src/ui.js")},"ckeditor5/src/widget.js":(e,t,o)=>{e.exports=o("dll-reference CKEditor5.dll")("./src/widget.js")},"dll-reference CKEditor5.dll":e=>{"use strict";e.exports=CKEditor5.dll}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};return(()=>{"use strict";o.d(n,{default:()=>m});var e=o("ckeditor5/src/core.js"),t=o("ckeditor5/src/widget.js");class r extends e.Command{execute(e){const t=this.editor.plugins.get("footnotesEditing"),o=Object.entries(t.attrs).reduce(((e,[t,o])=>(e[o]=t,e)),{}),n=Object.keys(e).reduce(((t,n)=>(o[n]&&(void 0!==e[n].value?t[o[n]]=e[n].value:t[o[n]]=e[n]),t)),{});this.editor.model.change((e=>{this.editor.model.insertContent(function(e,t){return e.createElement("footnotes",t)}(e,n))}))}refresh(){const{model:e}=this.editor,{selection:t}=e.document,o=e.schema.findAllowedParent(t.getFirstPosition(),"footnotes");this.isEnabled=null!==o}}function i(){return new URLSearchParams(window.location.search).has("debug")}function s(e){i()&&(console.log("Content received from paste pipeline:"),console.log(e));e.querySelectorAll('.sdfootnote, [id*="ftn"] > p, [id*="sdfootnote"] > p').forEach((t=>{let o=function(e){if("string"!=typeof e)throw new Error("Expected a string as input, got: "+typeof e);const t=(new DOMParser).parseFromString(e,"text/html"),o=document.createDocumentFragment();Array.from(t.body.childNodes).forEach((function e(t){if(t.nodeType===Node.ELEMENT_NODE){const n=t.tagName.toLowerCase();if("b"===n||"strong"===n){const e=document.createElement("b");e.innerHTML=t.innerHTML,o.appendChild(e)}else if("i"===n||"em"===n){const e=document.createElement("i");e.innerHTML=t.innerHTML,o.appendChild(e)}else if("a"===n){const e=t.href.split("#")[1]||"";if(!e.startsWith("sdfootnote")&&!e.startsWith("ftn")&&!e.startsWith("_ftn")){const e=document.createElement("a");e.href=t.href,e.innerHTML=t.innerHTML,o.appendChild(e)}}else Array.from(t.childNodes).forEach(e)}else t.nodeType===Node.TEXT_NODE&&o.appendChild(document.createTextNode(t.textContent))}));const n=document.createElement("div");return n.appendChild(o),n.innerHTML.trim()}(t.innerHTML);const n=t.querySelector('.sdfootnotesym, [ href*="_ftnref"]');if(n){let t=n.getAttribute("href").replace(/anc|ref|_/g,"");t=`#${t.split("#").pop()}`;const r=e.querySelector(`.sdfootnoteanc[href*="${t}sym"], [href*="_ftn"]`),s=e.querySelector(`div${t}`),c="";if(r){if(!o&&s.querySelector(".MsoFootnoteReference")){const e=s.querySelector(".MsoFootnoteReference").parentNode;void 0!==e&&e.parentNode.removeChild(e);const t=s.querySelector(".MsoFootnoteText");t&&(o=t.innerHTML)}if(o){const e=function(e,t){const o=document.createElement("footnotes");return o.setAttribute("data-value",e),o.setAttribute("data-text",t),o.innerHTML="&nbsp;",o}(c,o);i()&&(console.log("Created footnotes element:"),console.log(e),console.log("Replacing citation element:"),console.log(r),console.log("Removing anchor div:"),console.log(s)),r.parentNode.replaceChild(e,r),s.parentNode.removeChild(s)}}}}));const t=e.querySelectorAll('div[style*="mso-element:footnote-list;"]');t&&t.length>0&&t.forEach((e=>{e.parentNode.removeChild(e)}));return e.querySelectorAll("footnotes").forEach((e=>{e.setAttribute("data-value","")})),i()&&(console.log("Returning document fragment:"),console.log(e)),e}class c extends e.Plugin{static get requires(){return[t.Widget]}static get pluginName(){return"footnotesEditing"}init(){this.attrs={footnotesText:"data-text",footnotesValue:"data-value"};const e=this.editor.config.get("footnotes");if(!e)return;const{previewURL:t,themeError:o}=e;this.previewUrl=t,this.themeError=o||`\n <p>${Drupal.t("An error occurred while trying to preview the embedded content. Please save your work and reload this page.")}<p>\n `,this._defineSchema(),this._defineConverters(),this.editor.commands.add("footnotes",new r(this.editor)),this.editor.plugins.get("ClipboardPipeline").on("inputTransformation",((e,t)=>{if((t.content.getChild(0).data||"").includes("<footnote"))return;const o=t.content,n=s(this.editor.editing.view.domConverter.viewToDom(o)),r=this.editor.editing.view.domConverter.domToView(n);i()&&(console.log("Original view fragment:"),console.log(o),console.log("Transformed view fragment:"),console.log(r)),t.content=r}),{priority:"highest"})}async _fetchPreview(e){const t={text:e.getAttribute("footnotesText"),value:e.getAttribute("footnotesValue")},o=await fetch(`${this.previewUrl}?${new URLSearchParams(t)}`);return o.ok?o.text():this.themeError}_defineSchema(){const{schema:e}=this.editor.model;e.register("footnotes",{allowWhere:"$inlineObject",blockObject:!1,isObject:!0,isContent:!0,isBlock:!1,isInline:!0,inlineObject:!0,allowAttributes:Object.keys(this.attrs)}),this.editor.editing.view.domConverter.blockElements.push("footnotes")}_defineConverters(){const{conversion:e}=this.editor;e.for("upcast").elementToElement({view:{name:"footnotes"},model:"footnotes"}),e.for("dataDowncast").elementToElement({model:"footnotes",view:{name:"footnotes"}}),e.for("editingDowncast").elementToElement({model:"footnotes",view:(e,{writer:o})=>{const n=o.createContainerElement("span");return(0,t.toWidget)(n,o,{label:Drupal.t("Footnotes")})}}).add((e=>(e.on("attribute:footnotesValue:footnotes",((e,t,o)=>{const n=o.writer,r=t.item,i=o.mapper.toViewElement(t.item),s=n.createRawElement("span",{"data-footnotes-preview":"loading",class:"footnotes-preview"});n.insert(n.createPositionAt(i,0),s),this._fetchPreview(r).then((e=>{s&&this.editor.editing.view.change((t=>{const o=t.createRawElement("span",{class:"footnotes-preview","data-footnotes-preview":"ready"},(t=>{t.innerHTML=e}));t.insert(t.createPositionBefore(s),o),t.remove(s)}))}))})),e))),Object.keys(this.attrs).forEach((t=>{const o={model:{key:t,name:"footnotes"},view:{name:"footnotes",key:this.attrs[t]}};e.for("dataDowncast").attributeToAttribute(o),e.for("upcast").attributeToAttribute(o)}))}}var a=o("ckeditor5/src/ui.js"),l=o("ckeditor5/src/engine.js");class d extends l.DomEventObserver{constructor(e){super(e),this.domEventType="dblclick"}onDomEvent(e){this.fire(e.type,e)}}class f extends e.Plugin{init(){const{editor:e}=this,t=this.editor.config.get("footnotes");if(!t)return;const{dialogURL:o,openDialog:n,dialogSettings:r={}}=t;if(!o||"function"!=typeof n)return;e.ui.componentFactory.add("footnotes",(t=>{const i=e.commands.get("footnotes"),s=new a.ButtonView(t);return s.set({label:Drupal.t("Footnotes"),icon:'<?xml version="1.0" standalone="no"?>\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"\n "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\n<svg version="1.0" xmlns="http://www.w3.org/2000/svg"\n width="16.000000pt" height="16.000000pt" viewBox="0 0 16.000000 16.000000"\n preserveAspectRatio="xMidYMid meet">\n\n<g transform="translate(0.000000,16.000000) scale(0.100000,-0.100000)"\nfill="#000000" stroke="none">\n<path d="M115 115 c0 -14 5 -25 11 -25 7 0 9 10 6 25 -2 14 -7 25 -11 25 -3 0\n-6 -11 -6 -25z"/>\n<path d="M35 110 c-4 -6 5 -10 19 -10 14 0 26 -4 26 -10 0 -5 -8 -10 -19 -10\n-24 0 -45 -25 -38 -45 4 -9 19 -14 42 -13 33 1 35 3 35 38 0 20 -5 41 -12 48\n-15 15 -45 16 -53 2z m45 -60 c0 -5 -9 -10 -20 -10 -11 0 -20 5 -20 10 0 6 9\n10 20 10 11 0 20 -4 20 -10z"/>\n</g>\n</svg>\n',tooltip:!0}),s.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(s,"execute",(()=>{const t=e.model.document.selection.getSelectedElement(),i=new URL(o,document.baseURI);t&&void 0!==t.name&&"footnotes"===t.name&&(i.searchParams.append("text",t.getAttribute("footnotesText")),i.searchParams.append("value",t.getAttribute("footnotesValue"))),n(i.toString(),(({attributes:t})=>{e.execute("footnotes",t)}),r)})),s}));const{view:i}=e.editing,s=i.document;i.addObserver(d),e.listenTo(s,"dblclick",((t,i)=>{const s=e.editing.mapper.toModelElement(i.target.parent);if(s&&void 0!==s.name&&"footnotes"===s.name){const t={text:s.getAttribute("footnotesText"),value:s.getAttribute("footnotesValue")};n(`${o}?${new URLSearchParams(t)}`,(({attributes:t})=>{e.execute("footnotes",t)}),r)}}))}}class u extends e.Plugin{static get requires(){return[c,f]}static get pluginName(){return"footnotes"}}const m={Footnotes:u}})(),n=n.default})()));
\ No newline at end of file
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.CKEditor5=t():(e.CKEditor5=e.CKEditor5||{},e.CKEditor5.footnotes=t())}(self,(()=>(()=>{var e={"ckeditor5/src/core.js":(e,t,o)=>{e.exports=o("dll-reference CKEditor5.dll")("./src/core.js")},"ckeditor5/src/engine.js":(e,t,o)=>{e.exports=o("dll-reference CKEditor5.dll")("./src/engine.js")},"ckeditor5/src/ui.js":(e,t,o)=>{e.exports=o("dll-reference CKEditor5.dll")("./src/ui.js")},"ckeditor5/src/widget.js":(e,t,o)=>{e.exports=o("dll-reference CKEditor5.dll")("./src/widget.js")},"dll-reference CKEditor5.dll":e=>{"use strict";e.exports=CKEditor5.dll}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};return(()=>{"use strict";o.d(n,{default:()=>m});var e=o("ckeditor5/src/core.js"),t=o("ckeditor5/src/widget.js");class r extends e.Command{execute(e){const t=this.editor.plugins.get("footnotesEditing"),o=Object.entries(t.attrs).reduce(((e,[t,o])=>(e[o]=t,e)),{}),n=Object.keys(e).reduce(((t,n)=>(o[n]&&(void 0!==e[n].value?t[o[n]]=e[n].value:t[o[n]]=e[n]),t)),{});this.editor.model.change((e=>{this.editor.model.insertContent(function(e,t){return e.createElement("footnotes",t)}(e,n))}))}refresh(){const{model:e}=this.editor,{selection:t}=e.document,o=e.schema.findAllowedParent(t.getFirstPosition(),"footnotes");this.isEnabled=null!==o}}function i(){return new URLSearchParams(window.location.search).has("debug")}function s(e){i()&&(console.log("Content received from paste pipeline:"),console.log(e));e.querySelectorAll('.sdfootnote, [id*="ftn"] > p, [id*="sdfootnote"] > p').forEach((t=>{let o=function(e){if("string"!=typeof e)throw new Error("Expected a string as input, got: "+typeof e);const t=(new DOMParser).parseFromString(e,"text/html"),o=document.createDocumentFragment();Array.from(t.body.childNodes).forEach((function e(t){if(t.nodeType===Node.ELEMENT_NODE){const n=t.tagName.toLowerCase();if("b"===n||"strong"===n){const e=document.createElement("b");e.innerHTML=t.innerHTML,o.appendChild(e)}else if("i"===n||"em"===n){const e=document.createElement("i");e.innerHTML=t.innerHTML,o.appendChild(e)}else if("a"===n){const e=t.href.split("#")[1]||"";if(!e.startsWith("sdfootnote")&&!e.startsWith("ftn")&&!e.startsWith("_ftn")){const e=document.createElement("a");e.href=t.href,e.innerHTML=t.innerHTML,o.appendChild(e)}}else Array.from(t.childNodes).forEach(e)}else t.nodeType===Node.TEXT_NODE&&o.appendChild(document.createTextNode(t.textContent))}));const n=document.createElement("div");return n.appendChild(o),n.innerHTML.trim()}(t.innerHTML);const n=t.querySelector('.sdfootnotesym, [ href*="_ftnref"]');if(n){let t=n.getAttribute("href").replace(/anc|ref|_/g,"");t=`#${t.split("#").pop()}`;const r=e.querySelector(`.sdfootnoteanc[href*="${t}sym"], [href*="_ftn"]`),s=e.querySelector(`div${t}`),c="";if(r){if(!o&&s.querySelector(".MsoFootnoteReference")){const e=s.querySelector(".MsoFootnoteReference").parentNode;void 0!==e&&e.parentNode.removeChild(e);const t=s.querySelector(".MsoFootnoteText");t&&(o=t.innerHTML)}if(o){const e=function(e,t){const o=document.createElement("footnotes");return o.setAttribute("data-value",e),o.setAttribute("data-text",t),o.innerHTML="&nbsp;",o}(c,o);i()&&(console.log("Created footnotes element:"),console.log(e),console.log("Replacing citation element:"),console.log(r),console.log("Removing anchor div:"),console.log(s)),r.parentNode.replaceChild(e,r),s.parentNode.removeChild(s)}}}}));const t=e.querySelectorAll('div[style*="mso-element:footnote-list;"]');t&&t.length>0&&t.forEach((e=>{e.parentNode.removeChild(e)}));return e.querySelectorAll("footnotes").forEach((e=>{e.setAttribute("data-value","")})),i()&&(console.log("Returning document fragment:"),console.log(e)),e}class c extends e.Plugin{static get requires(){return[t.Widget]}static get pluginName(){return"footnotesEditing"}init(){this.attrs={footnotesText:"data-text",footnotesValue:"data-value"};const e=this.editor.config.get("footnotes");if(!e)return;const{previewURL:t,themeError:o}=e;this.previewUrl=t,this.themeError=o||`\n <p>${Drupal.t("An error occurred while trying to preview the embedded content. Please save your work and reload this page.")}<p>\n `,this._defineSchema(),this._defineConverters(),this.editor.commands.add("footnotes",new r(this.editor)),this.editor.plugins.get("ClipboardPipeline").on("inputTransformation",((e,t)=>{const o=t.content,n=s(this.editor.editing.view.domConverter.viewToDom(o)),r=this.editor.editing.view.domConverter.domToView(n);i()&&(console.log("Original view fragment:"),console.log(o),console.log("Transformed view fragment:"),console.log(r)),t.content=r}),{priority:"highest"})}async _fetchPreview(e){const t={text:e.getAttribute("footnotesText"),value:e.getAttribute("footnotesValue")},o=await fetch(`${this.previewUrl}?${new URLSearchParams(t)}`);return o.ok?o.text():this.themeError}_defineSchema(){const{schema:e}=this.editor.model;e.register("footnotes",{allowWhere:"$inlineObject",blockObject:!1,isObject:!0,isContent:!0,isBlock:!1,isInline:!0,inlineObject:!0,allowAttributes:Object.keys(this.attrs)}),this.editor.editing.view.domConverter.blockElements.push("footnotes")}_defineConverters(){const{conversion:e}=this.editor;e.for("upcast").elementToElement({view:{name:"footnotes"},model:"footnotes"}),e.for("dataDowncast").elementToElement({model:"footnotes",view:{name:"footnotes"}}),e.for("editingDowncast").elementToElement({model:"footnotes",view:(e,{writer:o})=>{const n=o.createContainerElement("span");return(0,t.toWidget)(n,o,{label:Drupal.t("Footnotes")})}}).add((e=>(e.on("attribute:footnotesValue:footnotes",((e,t,o)=>{const n=o.writer,r=t.item,i=o.mapper.toViewElement(t.item),s=n.createRawElement("span",{"data-footnotes-preview":"loading",class:"footnotes-preview"});n.insert(n.createPositionAt(i,0),s),this._fetchPreview(r).then((e=>{s&&this.editor.editing.view.change((t=>{const o=t.createRawElement("span",{class:"footnotes-preview","data-footnotes-preview":"ready"},(t=>{t.innerHTML=e}));t.insert(t.createPositionBefore(s),o),t.remove(s)}))}))})),e))),Object.keys(this.attrs).forEach((t=>{const o={model:{key:t,name:"footnotes"},view:{name:"footnotes",key:this.attrs[t]}};e.for("dataDowncast").attributeToAttribute(o),e.for("upcast").attributeToAttribute(o)}))}}var a=o("ckeditor5/src/ui.js"),l=o("ckeditor5/src/engine.js");class d extends l.DomEventObserver{constructor(e){super(e),this.domEventType="dblclick"}onDomEvent(e){this.fire(e.type,e)}}class f extends e.Plugin{init(){const{editor:e}=this,t=this.editor.config.get("footnotes");if(!t)return;const{dialogURL:o,openDialog:n,dialogSettings:r={}}=t;if(!o||"function"!=typeof n)return;e.ui.componentFactory.add("footnotes",(t=>{const i=e.commands.get("footnotes"),s=new a.ButtonView(t);return s.set({label:Drupal.t("Footnotes"),icon:'<?xml version="1.0" standalone="no"?>\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"\n "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">\n<svg version="1.0" xmlns="http://www.w3.org/2000/svg"\n width="16.000000pt" height="16.000000pt" viewBox="0 0 16.000000 16.000000"\n preserveAspectRatio="xMidYMid meet">\n\n<g transform="translate(0.000000,16.000000) scale(0.100000,-0.100000)"\nfill="#000000" stroke="none">\n<path d="M115 115 c0 -14 5 -25 11 -25 7 0 9 10 6 25 -2 14 -7 25 -11 25 -3 0\n-6 -11 -6 -25z"/>\n<path d="M35 110 c-4 -6 5 -10 19 -10 14 0 26 -4 26 -10 0 -5 -8 -10 -19 -10\n-24 0 -45 -25 -38 -45 4 -9 19 -14 42 -13 33 1 35 3 35 38 0 20 -5 41 -12 48\n-15 15 -45 16 -53 2z m45 -60 c0 -5 -9 -10 -20 -10 -11 0 -20 5 -20 10 0 6 9\n10 20 10 11 0 20 -4 20 -10z"/>\n</g>\n</svg>\n',tooltip:!0}),s.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(s,"execute",(()=>{const t=e.model.document.selection.getSelectedElement(),i=new URL(o,document.baseURI);t&&void 0!==t.name&&"footnotes"===t.name&&(i.searchParams.append("text",t.getAttribute("footnotesText")),i.searchParams.append("value",t.getAttribute("footnotesValue"))),n(i.toString(),(({attributes:t})=>{e.execute("footnotes",t)}),r)})),s}));const{view:i}=e.editing,s=i.document;i.addObserver(d),e.listenTo(s,"dblclick",((t,i)=>{const s=e.editing.mapper.toModelElement(i.target.parent);if(s&&void 0!==s.name&&"footnotes"===s.name){const t={text:s.getAttribute("footnotesText"),value:s.getAttribute("footnotesValue")};n(`${o}?${new URLSearchParams(t)}`,(({attributes:t})=>{e.execute("footnotes",t)}),r)}}))}}class u extends e.Plugin{static get requires(){return[c,f]}static get pluginName(){return"footnotes"}}const m={Footnotes:u}})(),n=n.default})()));
\ No newline at end of file
......@@ -233,11 +233,6 @@ export default class Footnotesediting extends Plugin {
this.editor.plugins.get('ClipboardPipeline').on(
'inputTransformation',
(evt, data) => {
// Already completed.
const contentString = data.content.getChild(0).data || '';
if (contentString.includes('<footnote')) {
return;
}
// Convert the view document fragment to a DOM document fragment.
const viewFragment = data.content;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment