@rg-dev/tinymce-helpers 1.0.13 → 1.0.15
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/index.mjs +38 -28
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -63,7 +63,7 @@ import "tinymce/plugins/preview";
|
|
|
63
63
|
import "tinymce/plugins/insertdatetime";
|
|
64
64
|
|
|
65
65
|
// src/client/custom-components/mce.css?raw
|
|
66
|
-
var mce_default = ':where(.mce-content-body) {\n --editor-text: #000;\n --editor-link: #000;\n --editor-border: #d6d6d6c9;\n --editor-table-header-text: #6e6e6e;\n --editor-table-row-even: #fafafa;\n --editor-hr: #bbb;\n}\n\n\nli::marker {\n color: var(--editor-link) !important;\n}\n\n::-webkit-scrollbar {\n width: 10px;\n}\n\n::-webkit-scrollbar-track {\n background: var(--editor-table-row-even);\n}\n\n::-webkit-scrollbar-thumb {\n background: var(--editor-link);\n border-radius: 35px;\n}\n\n @media print {\n .mce-content-body {\n --editor-text: #000;\n --editor-link: #000;\n --editor-border: #d6d6d6c9;\n --editor-table-header-text: #000;\n --editor-table-row-even: #fafafa;\n --editor-hr: #000;\n }\n\n .mce-content-body table tr:nth-child(even) {\n background: var(--editor-table-row-even) !important;\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n }\n\n \n .mce-content-body blockquote {\n border-inline-start: none !important;\n background: #f9f9f9 !important;\n\n color: #000 !important;\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n }\n\n \n\n .mce-content-body td[data-mce-selected]::after,\n .mce-content-body th[data-mce-selected]::after {\n display: none !important;\n}\n}\n\n img {\n padding-block: 7px;\n max-width: 100%;\n }\n\n\n\n .mce-content-body blockquote {\n display: flow-root;\n padding: 15px;\n border-radius: 8px;\n margin: 0px !important;\n margin-block: 20px !important;\n overflow: hidden;\n border: none !important;\n background: var(--editor-table-row-even);\n color: var(--editor-text);\n}\n\n\n\n.mce-content-body blockquote p {\n margin: 0;\n}\n\n* {\n
|
|
66
|
+
var mce_default = ':where(.mce-content-body) {\n --editor-text: #000;\n --editor-link: #000;\n --editor-border: #d6d6d6c9;\n --editor-table-header-text: #6e6e6e;\n --editor-table-row-even: #fafafa;\n --editor-hr: #bbb;\n}\n\n\nli::marker {\n color: var(--editor-link) !important;\n}\n\n::-webkit-scrollbar {\n width: 10px;\n}\n\n::-webkit-scrollbar-track {\n background: var(--editor-table-row-even);\n}\n\n::-webkit-scrollbar-thumb {\n background: var(--editor-link);\n border-radius: 35px;\n}\n\n @media print {\n .mce-content-body {\n --editor-text: #000;\n --editor-link: #000;\n --editor-border: #d6d6d6c9;\n --editor-table-header-text: #000;\n --editor-table-row-even: #fafafa;\n --editor-hr: #000;\n }\n\n .mce-content-body table tr:nth-child(even) {\n background: var(--editor-table-row-even) !important;\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n }\n\n \n .mce-content-body blockquote {\n border-inline-start: none !important;\n background: #f9f9f9 !important;\n\n color: #000 !important;\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n }\n\n \n\n .mce-content-body td[data-mce-selected]::after,\n .mce-content-body th[data-mce-selected]::after {\n display: none !important;\n}\n}\n\n img {\n padding-block: 7px;\n max-width: 100%;\n }\n\n\n\n .mce-content-body blockquote {\n display: flow-root;\n padding: 15px;\n border-radius: 8px;\n margin: 0px !important;\n margin-block: 20px !important;\n overflow: hidden;\n border: none !important;\n background: var(--editor-table-row-even);\n color: var(--editor-text);\n}\n\n\n\n.mce-content-body blockquote p {\n margin: 0;\n}\n\n* {\n border: 0;\n padding: 0;\n margin: 0;\n background: 0 0;\n color: inherit;\n box-sizing: border-box;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n font-weight: 400;\n}\n\n:focus {\n outline: 0;\n}\n\na {\n text-decoration: none;\n cursor: pointer;\n}\n\nb,\nb *,\nstrong,\nstrong * {\n font-weight: 700;\n}\n\nol,\nul {\n list-style: none;\n}\n\npre {\n font: inherit;\n}\n\nbutton,\ninput,\ninput:not([type]),\ninput[type="button"],\ninput[type="color"],\ninput[type="date"],\ninput[type="datetime-local"],\ninput[type="datetime"],\ninput[type="email"],\ninput[type="month"],\ninput[type="number"],\ninput[type="password"],\ninput[type="reset"],\ninput[type="search"],\ninput[type="submit"],\ninput[type="tel"],\ninput[type="text"],\ninput[type="time"],\ninput[type="url"],\ninput[type="week"],\nselect,\ntextarea {\n font: inherit;\n}\n\n.mce-container textarea {\n display: inline-block !important;\n} \n\n\n.my-custom-styles{\n direction: ltr;\n }\n\n.mce-content-body {\n font-size: 22px;\n font-family: Rubik, Helvetica, Arial, sans-serif;\n padding: 0 25px 25px;\n color: var(--editor-text);\n}\n\n.mce-content-body table {\n width: 100%;\n table-layout: fixed;\n}\n\n\n\n.mce-content-body table td,\n.mce-content-body table th {\n overflow-wrap: anywhere;\n word-break: break-word;\n white-space: normal;\n}\n\n\n.mce-content-body h1 {\n font-size: 34px;\n line-height: 1.4em;\n margin: 25px 0 15px;\n}\n\n.mce-content-body h2 {\n font-size: 30px;\n line-height: 1.4em;\n margin: 25px 0 15px;\n}\n\n.mce-content-body h3 {\n font-size: 26px;\n line-height: 1.4em;\n margin: 25px 0 15px;\n}\n\n.mce-content-body h4 {\n font-size: 22px;\n line-height: 1.4em;\n margin: 25px 0 15px;\n}\n\n.mce-content-body h5 {\n font-size: 18px;\n line-height: 1.4em;\n margin: 25px 0 15px;\n}\n\n.mce-content-body h6 {\n font-size: 14px;\n line-height: 1.4em;\n margin: 25px 0 15px;\n}\n\n.mce-content-body p {\n margin: 25px 0;\n}\n\n.mce-content-body pre {\n font-family: monospace;\n}\n\n.mce-content-body ol,\n.mce-content-body ul {\n margin-left: 15px;\n list-style-position: outside;\n margin-bottom: 20px;\n}\n\n.mce-content-body ol li,\n.mce-content-body ul li {\n margin-left: 10px;\n margin-bottom: 10px;\n color: var(--editor-text);\n}\n\n.mce-content-body ul {\n list-style-type: disc;\n}\n\n.mce-content-body ol {\n list-style-type: decimal;\n}\n\n.mce-content-body a[href] {\n color: var(--editor-link);\n text-decoration: underline;\n}\n\n.mce-content-body table caption,\n.mce-content-body table td,\n.mce-content-body table th {\n padding: 15px 7px;\n font: inherit;\n}\n\n.mce-content-body table td,\n.mce-content-body table th {\n border: 1px solid var(--editor-border) !important;\n border-collapse: collapse;\n}\n\n.mce-content-body table th {\n font-weight: 400;\n color: var(--editor-table-header-text);\n background-position: 100% 100%;\n background-size: 2px 10px;\n background-repeat: no-repeat;\n}\n\n.mce-content-body table {\n width: 100%;\n border-spacing: 0;\n border-collapse: separate;\n \n}\n\n.mce-content-body table tr:nth-child(even) {\n background: var(--editor-table-row-even);\n}\n\n.mce-content-body hr {\n border-top: 2px solid var(--editor-hr);\n}';
|
|
67
67
|
|
|
68
68
|
// src/client/custom-components/tinymce-helpers.ts
|
|
69
69
|
import { isNonEmptyString } from "@rg-dev/stdlib/lib/common-env";
|
|
@@ -120,7 +120,7 @@ function resolvePatch(defaults, patch) {
|
|
|
120
120
|
} else {
|
|
121
121
|
resolved = patch;
|
|
122
122
|
}
|
|
123
|
-
const _b = resolved, { target, setup, selector } = _b, safe = __objRest(_b, ["target", "setup", "selector"]);
|
|
123
|
+
const _b = resolved || {}, { target, setup, selector } = _b, safe = __objRest(_b, ["target", "setup", "selector"]);
|
|
124
124
|
return safe;
|
|
125
125
|
}
|
|
126
126
|
var ListBuilder = class {
|
|
@@ -376,36 +376,42 @@ var tinymceHelpers = class _tinymceHelpers {
|
|
|
376
376
|
input.click();
|
|
377
377
|
}
|
|
378
378
|
});
|
|
379
|
-
editor.ui.registry.addButton(
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if (
|
|
388
|
-
|
|
379
|
+
editor.ui.registry.addButton(
|
|
380
|
+
"decreaseFontSize",
|
|
381
|
+
{
|
|
382
|
+
tooltip: "Decrease Font Size",
|
|
383
|
+
icon: "minus",
|
|
384
|
+
onAction: () => {
|
|
385
|
+
const currentSize = editor.queryCommandValue("FontSize");
|
|
386
|
+
let newSize = 16;
|
|
387
|
+
if (currentSize) {
|
|
388
|
+
const sizeNum = parseInt(currentSize.toString());
|
|
389
|
+
if (!isNaN(sizeNum) && sizeNum > 8) {
|
|
390
|
+
newSize = sizeNum - 2;
|
|
391
|
+
}
|
|
389
392
|
}
|
|
393
|
+
editor.execCommand("FontSize", false, newSize + "px");
|
|
390
394
|
}
|
|
391
|
-
editor.execCommand("FontSize", false, newSize + "px");
|
|
392
395
|
}
|
|
393
|
-
|
|
394
|
-
editor.ui.registry.addButton(
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
if (
|
|
403
|
-
|
|
396
|
+
);
|
|
397
|
+
editor.ui.registry.addButton(
|
|
398
|
+
"increaseFontSize",
|
|
399
|
+
{
|
|
400
|
+
tooltip: "Increase Font Size",
|
|
401
|
+
icon: "plus",
|
|
402
|
+
onAction: () => {
|
|
403
|
+
const currentSize = editor.queryCommandValue("FontSize");
|
|
404
|
+
let newSize = 16;
|
|
405
|
+
if (currentSize) {
|
|
406
|
+
const sizeNum = parseInt(currentSize.toString());
|
|
407
|
+
if (!isNaN(sizeNum)) {
|
|
408
|
+
newSize = sizeNum + 2;
|
|
409
|
+
}
|
|
404
410
|
}
|
|
411
|
+
editor.execCommand("FontSize", false, newSize + "px");
|
|
405
412
|
}
|
|
406
|
-
editor.execCommand("FontSize", false, newSize + "px");
|
|
407
413
|
}
|
|
408
|
-
|
|
414
|
+
);
|
|
409
415
|
editor.ui.registry.addButton(
|
|
410
416
|
"myBlockquote",
|
|
411
417
|
{
|
|
@@ -592,8 +598,12 @@ var tinymceHelpers = class _tinymceHelpers {
|
|
|
592
598
|
if (opts.dir) {
|
|
593
599
|
this.toggleTextDirection(opts.dir);
|
|
594
600
|
}
|
|
595
|
-
|
|
596
|
-
|
|
601
|
+
if (typeof content == "string") {
|
|
602
|
+
this._editor.setContent(content);
|
|
603
|
+
this._editor.undoManager.clear();
|
|
604
|
+
} else {
|
|
605
|
+
console.error("setContent()", "content not a string");
|
|
606
|
+
}
|
|
597
607
|
}
|
|
598
608
|
getCustomStyles() {
|
|
599
609
|
const sheets = this._editor.getDoc().styleSheets;
|