opentiny 6.9.12 → 6.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/plugins/anchor/plugin.js
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
(function () {
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
|
-
var global$
|
|
8
|
+
var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager');
|
|
9
9
|
|
|
10
|
-
var global$
|
|
10
|
+
var global$2 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
|
|
11
11
|
|
|
12
|
-
var global = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
12
|
+
var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
|
|
13
13
|
|
|
14
14
|
const option = name => editor => editor.options.get(name);
|
|
15
15
|
const register$2 = editor => {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
|
|
34
34
|
const removeEmptyNamedAnchorsInSelection = editor => {
|
|
35
35
|
const dom = editor.dom;
|
|
36
|
-
global$
|
|
37
|
-
global.each(nodes, node => {
|
|
36
|
+
global$2(dom).walk(editor.selection.getRng(), nodes => {
|
|
37
|
+
global$1.each(nodes, node => {
|
|
38
38
|
if (isEmptyNamedAnchor(node)) {
|
|
39
39
|
dom.remove(node, false);
|
|
40
40
|
}
|
|
@@ -82,6 +82,8 @@
|
|
|
82
82
|
editor.focus();
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
+
var global = tinymce.util.Tools.resolve('tinymce.util.I18n');
|
|
86
|
+
|
|
85
87
|
const insertAnchor = (editor, newId) => {
|
|
86
88
|
if (!isValidId(newId)) {
|
|
87
89
|
editor.windowManager.alert('ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.');
|
|
@@ -101,7 +103,7 @@
|
|
|
101
103
|
items: [
|
|
102
104
|
{
|
|
103
105
|
type: 'htmlpanel',
|
|
104
|
-
html: '<p style="font-size: 14px; margin-bottom: 10px;">The anchor tool is used to create a link that allows the user to jump to a specific part of the document marked by the anchor. For example, you can link to an image or a specific section of text (e.g., a heading or a paragraph)<br><br>Enter an anchor identifier in the "ID" field (e.g., "anchor1") > click Save > Insert > Link > select the anchor in the "Anchors" field > the "Link URL" and "Link Text" fields will auto-fill > adjust the "Link Title" as needed
|
|
106
|
+
html: '<p style="font-size: 14px; margin-bottom: 10px;">' + global.translate('The anchor tool is used to create a link that allows the user to jump to a specific part of the document marked by the anchor. For example, you can link to an image or a specific section of text (e.g., a heading or a paragraph)') + '<br><br>' + global.translate('Enter an anchor identifier in the "ID" field (e.g., "anchor1") > click Save > Insert > Link > select the anchor in the "Anchors" field > the "Link URL" and "Link Text" fields will auto-fill > adjust the "Link Title" as needed.') + '</p>'
|
|
105
107
|
},
|
|
106
108
|
{
|
|
107
109
|
name: 'id',
|
|
@@ -204,7 +206,7 @@
|
|
|
204
206
|
};
|
|
205
207
|
|
|
206
208
|
var Plugin = () => {
|
|
207
|
-
global$
|
|
209
|
+
global$3.add('anchor', editor => {
|
|
208
210
|
register$2(editor);
|
|
209
211
|
setup(editor);
|
|
210
212
|
register$1(editor);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TinyMCE version 7.0.0 (TBD)
|
|
3
3
|
*/
|
|
4
|
-
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),n=tinymce.util.Tools.resolve("tinymce.util.Tools");const o=e=>e.options.get("allow_html_in_named_anchor");const a="a:not([href])",r=e=>!e,i=e=>e.getAttribute("id")||e.getAttribute("name")||"",l=e=>(e=>"a"===e.nodeName.toLowerCase())(e)&&!e.getAttribute("href")&&""!==i(e),s=e=>e.dom.getParent(e.selection.getStart(),a),c=(e,a)=>{const r=s(e);r?((e,t,n)=>{n.removeAttribute("name"),n.id=t,e.addVisual(),e.undoManager.add()})(e,a,r):((e,a)=>{e.undoManager.transact((()=>{o(e)||e.selection.collapse(!0),e.selection.isCollapsed()?e.insertContent(e.dom.createHTML("a",{id:a})):((e=>{const o=e.dom;t(o).walk(e.selection.getRng(),(e=>{n.each(e,(e=>{var t;l(t=e)&&!t.firstChild&&o.remove(e,!1)}))}))})(e),e.formatter.remove("namedAnchor",void 0,void 0,!0),e.formatter.apply("namedAnchor",{value:a}),e.addVisual())}))})(e,a),e.focus()}
|
|
4
|
+
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),n=tinymce.util.Tools.resolve("tinymce.util.Tools");const o=e=>e.options.get("allow_html_in_named_anchor");const a="a:not([href])",r=e=>!e,i=e=>e.getAttribute("id")||e.getAttribute("name")||"",l=e=>(e=>"a"===e.nodeName.toLowerCase())(e)&&!e.getAttribute("href")&&""!==i(e),s=e=>e.dom.getParent(e.selection.getStart(),a),c=(e,a)=>{const r=s(e);r?((e,t,n)=>{n.removeAttribute("name"),n.id=t,e.addVisual(),e.undoManager.add()})(e,a,r):((e,a)=>{e.undoManager.transact((()=>{o(e)||e.selection.collapse(!0),e.selection.isCollapsed()?e.insertContent(e.dom.createHTML("a",{id:a})):((e=>{const o=e.dom;t(o).walk(e.selection.getRng(),(e=>{n.each(e,(e=>{var t;l(t=e)&&!t.firstChild&&o.remove(e,!1)}))}))})(e),e.formatter.remove("namedAnchor",void 0,void 0,!0),e.formatter.apply("namedAnchor",{value:a}),e.addVisual())}))})(e,a),e.focus()};var d=tinymce.util.Tools.resolve("tinymce.util.I18n");const m=e=>(e=>r(e.attr("href"))&&!r(e.attr("id")||e.attr("name")))(e)&&!e.firstChild,h=e=>t=>{for(let n=0;n<t.length;n++){const o=t[n];m(o)&&o.attr("contenteditable",e)}},u=e=>t=>{const n=()=>{t.setEnabled(e.selection.isEditable())};return e.on("NodeChange",n),n(),()=>{e.off("NodeChange",n)}};e.add("anchor",(e=>{(e=>{(0,e.options.register)("allow_html_in_named_anchor",{processor:"boolean",default:!1})})(e),(e=>{e.on("PreInit",(()=>{e.parser.addNodeFilter("a",h("false")),e.serializer.addNodeFilter("a",h(null))}))})(e),(e=>{e.addCommand("mceAnchor",(()=>{(e=>{const t=(e=>{const t=s(e);return t?i(t):""})(e);e.windowManager.open({title:"Anchor",size:"normal",body:{type:"panel",items:[{type:"htmlpanel",html:'<p style="font-size: 14px; margin-bottom: 10px;">'+d.translate("The anchor tool is used to create a link that allows the user to jump to a specific part of the document marked by the anchor. For example, you can link to an image or a specific section of text (e.g., a heading or a paragraph)")+"<br><br>"+d.translate('Enter an anchor identifier in the "ID" field (e.g., "anchor1") > click Save > Insert > Link > select the anchor in the "Anchors" field > the "Link URL" and "Link Text" fields will auto-fill > adjust the "Link Title" as needed.')+"</p>"},{name:"id",type:"input",label:"ID",placeholder:"example"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{id:t},onSubmit:t=>{((e,t)=>/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(t)?(c(e,t),!0):(e.windowManager.alert("ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),!1))(e,t.getData().id)&&t.close()}})})(e)}))})(e),(e=>{const t=()=>e.execCommand("mceAnchor");e.ui.registry.addToggleButton("anchor",{icon:"bookmark",tooltip:"Anchor",onAction:t,onSetup:t=>{const n=e.selection.selectorChangedWithUnbind("a:not([href])",t.setActive).unbind,o=u(e)(t);return()=>{n(),o()}}}),e.ui.registry.addMenuItem("anchor",{icon:"bookmark",text:"Anchor...",onAction:t,onSetup:u(e)})})(e),e.on("PreInit",(()=>{(e=>{e.formatter.register("namedAnchor",{inline:"a",selector:a,remove:"all",split:!0,deep:!0,attributes:{id:"%value"},onmatch:(e,t,n)=>l(e)})})(e)}))}))}();
|