refactor(client-side): externalize tinymce plugins list

This commit is contained in:
parent a65590d47e
commit 2730eac4b2
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -1,6 +1,18 @@
const plugins =
"a11ychecker advcode advtable advtemplate typography casechange checklist editimage mediaembed export footnotes formatpainter inlinecss mergetags pageembed permanentpen powerpaste autocorrect tableofcontents accordion advlist anchor autolink autoresize autosave charmap code codesample directionality emoticons fullscreen help image importcss insertdatetime link lists media nonbreaking pagebreak preview quickbars save searchreplace table template visualblocks visualchars wordcount".split(
" ",
);
const reducer = (pv, cv) => {
return { ...pv, [cv]: `plugins/${cv}/plugin.min.js` };
};
const external_plugins = plugins.reduce((pv, cv) => {
return { ...pv, [cv]: `plugins/${cv}/plugin.min.js` };
}, {});
const base_url = "/tinymce";
export const fancy = { export const fancy = {
branding: false, branding: false,
selector: "textarea#txt", base_url,
menubar: false, menubar: false,
elementpath: false, elementpath: false,
formats: { formats: {
@ -31,12 +43,12 @@ export const fancy = {
items: [ items: [
{ {
title: "Image Left", title: "Image Left",
selector: "img",
styles: { float: "left", margin: "0 10px 0 10px" }, styles: { float: "left", margin: "0 10px 0 10px" },
}, },
{ {
title: "Image Right", title: "Image Right",
selector: "img",
styles: { float: "right", margin: "0 0 10px 10px" }, styles: { float: "right", margin: "0 0 10px 10px" },
}, },
{ title: "Rounded corners", styles: { "border-radius": "0.7em" } }, { title: "Rounded corners", styles: { "border-radius": "0.7em" } },
@ -44,7 +56,7 @@ export const fancy = {
}, },
{ {
title: "Code/Monospace", title: "Code/Monospace",
selector: "p,div,h1,h2,h3,h4,h5,h6",
classes: ["font-mono"], classes: ["font-mono"],
}, },
], ],
@ -62,16 +74,11 @@ export const fancy = {
}, },
toolbar: "undo redo | paste | bold italic underline | hr image link | forecolor styles | heading alignment | code", toolbar: "undo redo | paste | bold italic underline | hr image link | forecolor styles | heading alignment | code",
contextmenu: "bold italic underline | hr | link | image | paste", contextmenu: "bold italic underline | hr | link | image | paste",
external_plugins: { external_plugins,
mentions: "/plugins/mentions/plugin.min.js",
},
plugins:
`advlist autolink lists link image charmap preview anchor searchreplace visualblocks advcode fullscreen insertdatetime media table help wordcount save mentions`.split(
" ",
),
}; };
export const comment = { export const comment = {
branding: false, branding: false,
base_url,
height: 200, height: 200,
menubar: false, menubar: false,
elementpath: false, elementpath: false,
@ -86,21 +93,15 @@ export const comment = {
inline: "u", inline: "u",
}, },
}, },
external_plugins: {
mentions: "/plugins/mentions/plugin.min.js",
},
schema: "html5", schema: "html5",
plugins: external_plugins,
`advlist autolink lists link image charmap preview anchor searchreplace visualblocks code fullscreen insertdatetime media table code help save mentions`.split(
" ",
),
toolbar: "bold italic underline | link", toolbar: "bold italic underline | link",
contextmenu: "bold italic underline | paste | link", contextmenu: "bold italic underline | paste | link",
}; };
export const story = { export const story = {
base_url,
branding: false, branding: false,
selector: "textarea#txt",
height: 500, height: 500,
menubar: false, menubar: false,
elementpath: false, elementpath: false,
@ -117,14 +118,12 @@ export const story = {
}, },
content_css: ["/test.css", "/quickfix.css"], content_css: ["/test.css", "/quickfix.css"],
schema: "html5", schema: "html5",
plugins: external_plugins,
`advlist autolink lists link image charmap preview anchor searchreplace visualblocks code fullscreen insertdatetime media table advcode help wordcount save`.split(
" ",
),
toolbar: "undo redo | paste |" + "bold italic underline | hr | alignleft aligncenter " + "alignright alignjustify | " + "| code", toolbar: "undo redo | paste |" + "bold italic underline | hr | alignleft aligncenter " + "alignright alignjustify | " + "| code",
contextmenu: "bold italic underline | hr | paste | link", contextmenu: "bold italic underline | hr | paste | link",
}; };
export const bare = { export const bare = {
base_url,
branding: false, branding: false,
height: 200, height: 200,
menubar: false, menubar: false,
@ -141,13 +140,7 @@ export const bare = {
}, },
}, },
schema: "html5", schema: "html5",
external_plugins: { external_plugins,
mentions: "/plugins/mentions/plugin.min.js",
},
plugins:
`advlist autolink lists link image charmap preview anchor searchreplace visualblocks code fullscreen insertdatetime media table advcode help save mentions`.split(
" ",
),
toolbar: "bold italic underline | hr link", toolbar: "bold italic underline | hr link",
contextmenu: "bold italic underline | paste | hr link", contextmenu: "bold italic underline | paste | hr link",
}; };