@richscripts/richtexteditor 2.5.4 → 2.6.0
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/README.md +29 -2
- package/package.json +142 -142
- package/richtexteditor/CHANGELOG.md +2714 -2201
- package/richtexteditor/all_plugins.js +729 -9
- package/richtexteditor/all_plugins.min.js +52 -52
- package/richtexteditor/plugins/accessibilitychecker.js +60 -3
- package/richtexteditor/plugins/aitoolkit.js +24 -6
- package/richtexteditor/plugins/aitoolkit.min.css +1 -0
- package/richtexteditor/plugins/all_plugins.js +729 -9
- package/richtexteditor/plugins/all_plugins.min.js +52 -52
- package/richtexteditor/plugins/layouttable.js +383 -0
- package/richtexteditor/plugins/shadowdom.js +252 -0
- package/richtexteditor/plugins/slashcommand.js +8 -0
- package/richtexteditor/rte-watchdog.js +303 -0
- package/richtexteditor/rte-webcomponent.js +351 -0
- package/richtexteditor/rte_mobile.min.css +1 -0
- package/richtexteditor/rte_theme_default.min.css +1 -0
- package/richtexteditor/runtime/richtexteditor_content.min.css +1 -0
- package/richtexteditor/runtime/richtexteditor_preview.min.css +1 -0
|
@@ -522,11 +522,33 @@ function RTE_Plugin_AccessibilityChecker() {
|
|
|
522
522
|
var tables = tag === "table" ? [node] : (node.querySelectorAll ? node.querySelectorAll("table") : []);
|
|
523
523
|
for (var tableIndex = 0; tableIndex < tables.length; tableIndex++) {
|
|
524
524
|
var table = tables[tableIndex];
|
|
525
|
-
|
|
525
|
+
var tableRole = String(table.getAttribute("role") || "").toLowerCase();
|
|
526
|
+
var isLayoutTable = (tableRole === "presentation" || tableRole === "none");
|
|
527
|
+
|
|
528
|
+
// 2026-08-30 A layout table MUST NOT have headers, so demanding
|
|
529
|
+
// them here produced an error the author could never clear —
|
|
530
|
+
// which is how a checker teaches people to ignore it. Presentation
|
|
531
|
+
// tables are held to the opposite rule instead: they must not
|
|
532
|
+
// carry data-table semantics, because <th>/scope/<caption> make a
|
|
533
|
+
// screen reader announce relationships that do not exist
|
|
534
|
+
// (WCAG 1.3.1). See layouttable.js.
|
|
535
|
+
if (isLayoutTable) {
|
|
536
|
+
var semantic = table.querySelector("th, [scope], caption") || table.getAttribute("summary");
|
|
537
|
+
if (semantic) {
|
|
538
|
+
issues.push({
|
|
539
|
+
code: "layout-table-semantics",
|
|
540
|
+
severity: "error",
|
|
541
|
+
message: "Layout table still carries data-table markup (header cells, scope or a caption). A screen reader will announce relationships this table does not have.",
|
|
542
|
+
path: path + ".table[" + tableIndex + "]",
|
|
543
|
+
_target: table
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
else if (!table.querySelector("th")) {
|
|
526
548
|
issues.push({
|
|
527
549
|
code: "table-missing-header",
|
|
528
550
|
severity: "warning",
|
|
529
|
-
message: "Table has no header cells. Promote the first row to headers when it
|
|
551
|
+
message: "Table has no header cells. Promote the first row to headers, or mark it as a layout table when it only positions content.",
|
|
530
552
|
path: path + ".table[" + tableIndex + "]",
|
|
531
553
|
_target: table
|
|
532
554
|
});
|
|
@@ -557,7 +579,13 @@ function RTE_Plugin_AccessibilityChecker() {
|
|
|
557
579
|
target.parentNode.replaceChild(replacement, target);
|
|
558
580
|
}
|
|
559
581
|
else if (issue.code === "table-missing-header") {
|
|
560
|
-
|
|
582
|
+
// Two valid outcomes, and only the author knows which: the table
|
|
583
|
+
// describes data (give it headers) or only positions it (say so).
|
|
584
|
+
if (options && options.markLayout) markTableAsLayout(target);
|
|
585
|
+
else promoteFirstTableRow(target);
|
|
586
|
+
}
|
|
587
|
+
else if (issue.code === "layout-table-semantics") {
|
|
588
|
+
markTableAsLayout(target);
|
|
561
589
|
}
|
|
562
590
|
else if (issue.code === "language-of-parts") {
|
|
563
591
|
markLanguageRuns(target, options && options.lang ? options.lang : issue._lang, issue._script);
|
|
@@ -642,6 +670,35 @@ function RTE_Plugin_AccessibilityChecker() {
|
|
|
642
670
|
}
|
|
643
671
|
}
|
|
644
672
|
|
|
673
|
+
// Delegates to layouttable.js when it is loaded so there is ONE definition of
|
|
674
|
+
// what "layout table" means; the fallback keeps the repair working in builds
|
|
675
|
+
// where that plugin was left out of the bundle.
|
|
676
|
+
function markTableAsLayout(table) {
|
|
677
|
+
if (!table) return;
|
|
678
|
+
if (editor && typeof editor.setTableLayoutMode === "function") {
|
|
679
|
+
try { editor.setTableLayoutMode("layout", table); return; } catch (e) {}
|
|
680
|
+
}
|
|
681
|
+
table.setAttribute("role", "presentation");
|
|
682
|
+
table.removeAttribute("summary");
|
|
683
|
+
var caption = table.querySelector("caption");
|
|
684
|
+
if (caption && caption.parentNode === table) caption.parentNode.removeChild(caption);
|
|
685
|
+
var cells = table.querySelectorAll("th,[scope]");
|
|
686
|
+
for (var i = 0; i < cells.length; i++) {
|
|
687
|
+
var cell = cells[i];
|
|
688
|
+
// Tables nest — do not strip the headers of a data table that
|
|
689
|
+
// happens to sit inside a cell of this one.
|
|
690
|
+
if (cell.closest && cell.closest("table") !== table) continue;
|
|
691
|
+
cell.removeAttribute("scope");
|
|
692
|
+
cell.removeAttribute("headers");
|
|
693
|
+
if (String(cell.nodeName || "").toLowerCase() !== "th") continue;
|
|
694
|
+
var td = table.ownerDocument.createElement("td");
|
|
695
|
+
while (cell.firstChild) td.appendChild(cell.firstChild);
|
|
696
|
+
copyAttributes(cell, td);
|
|
697
|
+
td.removeAttribute("scope");
|
|
698
|
+
cell.parentNode.replaceChild(td, cell);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
|
|
645
702
|
function copyAttributes(source, target) {
|
|
646
703
|
if (!source || !target || !source.attributes) return;
|
|
647
704
|
for (var index = 0; index < source.attributes.length; index++) {
|
|
@@ -875,7 +932,9 @@ if (!window.RTE_DefaultConfig) window.RTE_DefaultConfig = {};
|
|
|
875
932
|
var existing = document.querySelectorAll("link[rel=stylesheet]");
|
|
876
933
|
for (var i = 0; i < existing.length; i++) {
|
|
877
934
|
var href = existing[i].getAttribute("href") || "";
|
|
878
|
-
|
|
935
|
+
// Matches the minified variant too - a host page that links either one
|
|
936
|
+
// must not get a second copy injected.
|
|
937
|
+
if (/(?:^|\/)aitoolkit(?:\.min)?\.css(?:\?.*)?$/i.test(href)) return;
|
|
879
938
|
}
|
|
880
939
|
// Locate our own script tag (aitoolkit.js or all_plugins.js) so we
|
|
881
940
|
// can resolve aitoolkit.css next to it. Matches a custom mount path.
|
|
@@ -889,14 +948,30 @@ if (!window.RTE_DefaultConfig) window.RTE_DefaultConfig = {};
|
|
|
889
948
|
}
|
|
890
949
|
}
|
|
891
950
|
var srcAttr = ourScript ? ourScript.getAttribute("src") : "";
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
951
|
+
// Prefer the minified stylesheet. aitoolkit.css is 537 KB unminified - larger
|
|
952
|
+
// than the obfuscated rte.js - and every page that loads the AI toolkit was
|
|
953
|
+
// paying for it. The readable .css is still shipped and still the one to edit
|
|
954
|
+
// or override; this only changes what gets fetched by default.
|
|
955
|
+
function resolve(name) {
|
|
956
|
+
return srcAttr
|
|
957
|
+
? srcAttr.replace(/[^/]+$/, name)
|
|
958
|
+
: (((window.RTE_DefaultConfig && window.RTE_DefaultConfig.url_base) || "/richtexteditor") + "/plugins/" + name);
|
|
959
|
+
}
|
|
960
|
+
function bust(href) { return href.indexOf("?") < 0 ? href + "?v=20260830a" : href; }
|
|
961
|
+
|
|
896
962
|
var link = document.createElement("link");
|
|
897
963
|
link.rel = "stylesheet";
|
|
898
|
-
link.href =
|
|
964
|
+
link.href = bust(resolve("aitoolkit.min.css"));
|
|
899
965
|
link.setAttribute("data-rte-auto-injected", "aitoolkit");
|
|
966
|
+
// .min.css is newer than .css. An install that predates it - an unpacked older
|
|
967
|
+
// zip, a tier the mirror missed - would otherwise lose ALL AI toolkit styling
|
|
968
|
+
// silently, which is a far worse failure than shipping the larger file. Fall
|
|
969
|
+
// back to the readable stylesheet if the minified one is not there.
|
|
970
|
+
link.onerror = function () {
|
|
971
|
+
if (link.getAttribute("data-rte-css-fallback")) return;
|
|
972
|
+
link.setAttribute("data-rte-css-fallback", "1");
|
|
973
|
+
link.href = bust(resolve("aitoolkit.css"));
|
|
974
|
+
};
|
|
900
975
|
(document.head || document.documentElement).appendChild(link);
|
|
901
976
|
})();
|
|
902
977
|
|
|
@@ -31274,6 +31349,390 @@ function RTE_Plugin_KeyboardA11y() {
|
|
|
31274
31349
|
|
|
31275
31350
|
if (!window.RTE_DefaultConfig) window.RTE_DefaultConfig = {};
|
|
31276
31351
|
|
|
31352
|
+
// 2026-08-30 Layout tables — say whether a table carries data or only geometry.
|
|
31353
|
+
//
|
|
31354
|
+
// Found by re-sweeping CKEditor 5's feature pages (they ship `layout-tables`);
|
|
31355
|
+
// TinyMCE has no equivalent. Every other editor treats <table> as one thing.
|
|
31356
|
+
// It is two:
|
|
31357
|
+
//
|
|
31358
|
+
// * a DATA table states relationships — this cell is described by that header —
|
|
31359
|
+
// and a screen reader announces them on every cell;
|
|
31360
|
+
// * a LAYOUT table states nothing. Newsletters, signatures and pre-CSS page
|
|
31361
|
+
// furniture use it purely for geometry, and the correct markup is
|
|
31362
|
+
// role="presentation", which tells assistive technology to read the cells as
|
|
31363
|
+
// plain flow content instead of narrating a fake grid.
|
|
31364
|
+
//
|
|
31365
|
+
// Using one where the other is meant is a real WCAG 1.3.1 failure, not a style
|
|
31366
|
+
// preference: a layout table with <th>/scope/<caption> makes a screen reader
|
|
31367
|
+
// announce column headers that describe nothing.
|
|
31368
|
+
//
|
|
31369
|
+
// It also fixes a false alarm we were shipping. `accessibilitychecker.js` raised
|
|
31370
|
+
// `table-missing-header` on EVERY table without a <th>, so an email layout — which
|
|
31371
|
+
// must not have one — produced a permanent error the author could never clear. A
|
|
31372
|
+
// checker that cannot be satisfied teaches people to ignore it, so the rule now
|
|
31373
|
+
// skips presentation tables and instead flags the genuine fault: a layout table
|
|
31374
|
+
// that still carries data-table semantics.
|
|
31375
|
+
//
|
|
31376
|
+
// Design notes:
|
|
31377
|
+
// - role="presentation" is the whole marker. No vendor class is added, so the
|
|
31378
|
+
// exported HTML gains nothing this editor has to own; `role=none` is the ARIA
|
|
31379
|
+
// synonym and is accepted on read, though we always write "presentation"
|
|
31380
|
+
// because Outlook-era mail clients are more likely to have heard of it.
|
|
31381
|
+
// - The dashed outline is injected into the EDITING document only (a <style> in
|
|
31382
|
+
// the iframe head, like formattingmarks.js), never into the content. A layout
|
|
31383
|
+
// table is invisible by design; without an affordance the author cannot see
|
|
31384
|
+
// the thing they are editing.
|
|
31385
|
+
// - Tables nest. Marking the outer table layout must not strip the headers of a
|
|
31386
|
+
// data table sitting inside one of its cells, so every walk is restricted to
|
|
31387
|
+
// cells whose nearest ancestor table is this one.
|
|
31388
|
+
// - Converting <th> to <td> loses information. Which cells were headers is
|
|
31389
|
+
// remembered per table in a WeakMap so an accidental toggle is reversible in
|
|
31390
|
+
// the session, and that memory is deliberately NOT written into the markup —
|
|
31391
|
+
// restoring it is a convenience, not a document property. Reloaded documents
|
|
31392
|
+
// therefore restore nothing; `promoteFirstRow` is offered for that case.
|
|
31393
|
+
RTE_DefaultConfig.plugin_layouttable = RTE_Plugin_LayoutTable;
|
|
31394
|
+
|
|
31395
|
+
// Show a dashed outline around layout tables while editing.
|
|
31396
|
+
if (typeof RTE_DefaultConfig.layoutTableOutline === "undefined") RTE_DefaultConfig.layoutTableOutline = true;
|
|
31397
|
+
|
|
31398
|
+
function RTE_Plugin_LayoutTable() {
|
|
31399
|
+
var obj = this;
|
|
31400
|
+
var config, editor;
|
|
31401
|
+
var headerMemory = (typeof WeakMap === "function") ? new WeakMap() : null;
|
|
31402
|
+
|
|
31403
|
+
obj.PluginName = "LayoutTable";
|
|
31404
|
+
|
|
31405
|
+
obj.InitConfig = function (argconfig) { config = argconfig; };
|
|
31406
|
+
|
|
31407
|
+
obj.InitEditor = function (argeditor) {
|
|
31408
|
+
editor = argeditor;
|
|
31409
|
+
|
|
31410
|
+
editor.attachEvent("exec_command_tablelayoutmode", function (state) {
|
|
31411
|
+
state.returnValue = true;
|
|
31412
|
+
obj.SetMode(tableAtCaret(), "layout");
|
|
31413
|
+
});
|
|
31414
|
+
editor.attachEvent("exec_command_tabledatamode", function (state) {
|
|
31415
|
+
state.returnValue = true;
|
|
31416
|
+
obj.SetMode(tableAtCaret(), "data");
|
|
31417
|
+
});
|
|
31418
|
+
editor.attachEvent("exec_command_toggletablelayout", function (state) {
|
|
31419
|
+
state.returnValue = true;
|
|
31420
|
+
obj.Toggle();
|
|
31421
|
+
});
|
|
31422
|
+
editor.attachEvent("exec_command_insertlayouttable", function (state) {
|
|
31423
|
+
state.returnValue = true;
|
|
31424
|
+
obj.InsertLayoutTable();
|
|
31425
|
+
});
|
|
31426
|
+
|
|
31427
|
+
// Public API.
|
|
31428
|
+
editor.setTableLayoutMode = function (mode, table, options) {
|
|
31429
|
+
return obj.SetMode(table || tableAtCaret(), mode, options);
|
|
31430
|
+
};
|
|
31431
|
+
editor.getTableLayoutMode = function (table) {
|
|
31432
|
+
var t = table || tableAtCaret();
|
|
31433
|
+
return t ? (isLayout(t) ? "layout" : "data") : null;
|
|
31434
|
+
};
|
|
31435
|
+
editor.isLayoutTable = function (table) { return isLayout(table || tableAtCaret()); };
|
|
31436
|
+
editor.toggleTableLayoutMode = function () { return obj.Toggle(); };
|
|
31437
|
+
editor.insertLayoutTable = function (rows, cols, options) {
|
|
31438
|
+
return obj.InsertLayoutTable(rows, cols, options);
|
|
31439
|
+
};
|
|
31440
|
+
editor.listLayoutTables = function () {
|
|
31441
|
+
var ed = getEditable();
|
|
31442
|
+
if (!ed) return [];
|
|
31443
|
+
var out = [], all = ed.getElementsByTagName("table");
|
|
31444
|
+
for (var i = 0; i < all.length; i++) if (isLayout(all[i])) out.push(all[i]);
|
|
31445
|
+
return out;
|
|
31446
|
+
};
|
|
31447
|
+
editor.showLayoutTableOutlines = function (on) {
|
|
31448
|
+
outlineOn = (on !== false);
|
|
31449
|
+
injectStyles(editableDoc());
|
|
31450
|
+
return outlineOn;
|
|
31451
|
+
};
|
|
31452
|
+
|
|
31453
|
+
try {
|
|
31454
|
+
if (config && typeof config.layoutTableOutline !== "undefined") outlineOn = !!config.layoutTableOutline;
|
|
31455
|
+
} catch (e) {}
|
|
31456
|
+
injectStyles(editableDoc());
|
|
31457
|
+
try {
|
|
31458
|
+
editor.attachEvent("editor_ready", function () { injectStyles(editableDoc()); });
|
|
31459
|
+
editor.attachEvent("update_design", function () { injectStyles(editableDoc()); });
|
|
31460
|
+
} catch (e) {}
|
|
31461
|
+
};
|
|
31462
|
+
|
|
31463
|
+
var outlineOn = true;
|
|
31464
|
+
|
|
31465
|
+
// ---------------------------------------------------------------- commands
|
|
31466
|
+
|
|
31467
|
+
obj.SetMode = function (table, mode, options) {
|
|
31468
|
+
if (!table) return null;
|
|
31469
|
+
if (String(mode).toLowerCase() === "layout") return toLayout(table);
|
|
31470
|
+
return toData(table, options);
|
|
31471
|
+
};
|
|
31472
|
+
|
|
31473
|
+
obj.Toggle = function () {
|
|
31474
|
+
var t = tableAtCaret();
|
|
31475
|
+
if (!t) return null;
|
|
31476
|
+
return isLayout(t) ? toData(t) : toLayout(t);
|
|
31477
|
+
};
|
|
31478
|
+
|
|
31479
|
+
obj.InsertLayoutTable = function (rows, cols, options) {
|
|
31480
|
+
var doc = editableDoc();
|
|
31481
|
+
if (!doc) return null;
|
|
31482
|
+
rows = Math.max(1, parseInt(rows, 10) || 2);
|
|
31483
|
+
cols = Math.max(1, parseInt(cols, 10) || 2);
|
|
31484
|
+
options = options || {};
|
|
31485
|
+
|
|
31486
|
+
var table = doc.createElement("table");
|
|
31487
|
+
table.setAttribute("role", "presentation");
|
|
31488
|
+
// The three attributes every email layout table needs; without
|
|
31489
|
+
// border-collapse the cells show a 2px gap in Outlook.
|
|
31490
|
+
table.setAttribute("cellpadding", "0");
|
|
31491
|
+
table.setAttribute("cellspacing", "0");
|
|
31492
|
+
table.style.width = options.width || "100%";
|
|
31493
|
+
table.style.borderCollapse = "collapse";
|
|
31494
|
+
|
|
31495
|
+
var tbody = doc.createElement("tbody");
|
|
31496
|
+
for (var r = 0; r < rows; r++) {
|
|
31497
|
+
var tr = doc.createElement("tr");
|
|
31498
|
+
for (var c = 0; c < cols; c++) {
|
|
31499
|
+
var td = doc.createElement("td");
|
|
31500
|
+
td.style.verticalAlign = "top";
|
|
31501
|
+
td.appendChild(doc.createElement("br"));
|
|
31502
|
+
tr.appendChild(td);
|
|
31503
|
+
}
|
|
31504
|
+
tbody.appendChild(tr);
|
|
31505
|
+
}
|
|
31506
|
+
table.appendChild(tbody);
|
|
31507
|
+
|
|
31508
|
+
insertAtCaret(table, doc);
|
|
31509
|
+
injectStyles(doc);
|
|
31510
|
+
fireChange();
|
|
31511
|
+
return table;
|
|
31512
|
+
};
|
|
31513
|
+
|
|
31514
|
+
// ------------------------------------------------------------- conversions
|
|
31515
|
+
|
|
31516
|
+
function toLayout(table) {
|
|
31517
|
+
table.setAttribute("role", "presentation");
|
|
31518
|
+
|
|
31519
|
+
// A caption is announced as the table's name; a layout table has no name
|
|
31520
|
+
// to announce. Keep the text — it is content the author typed — by moving
|
|
31521
|
+
// it out into a paragraph before the table rather than deleting it.
|
|
31522
|
+
var caption = firstOwnChild(table, "caption");
|
|
31523
|
+
if (caption) {
|
|
31524
|
+
var text = String(caption.textContent || "").replace(/^\s+|\s+$/g, "");
|
|
31525
|
+
if (text) {
|
|
31526
|
+
var p = table.ownerDocument.createElement("p");
|
|
31527
|
+
while (caption.firstChild) p.appendChild(caption.firstChild);
|
|
31528
|
+
if (table.parentNode) table.parentNode.insertBefore(p, table);
|
|
31529
|
+
}
|
|
31530
|
+
caption.parentNode.removeChild(caption);
|
|
31531
|
+
}
|
|
31532
|
+
|
|
31533
|
+
table.removeAttribute("summary");
|
|
31534
|
+
|
|
31535
|
+
var cells = ownCells(table), converted = [];
|
|
31536
|
+
for (var i = 0; i < cells.length; i++) {
|
|
31537
|
+
var cell = cells[i];
|
|
31538
|
+
cell.removeAttribute("scope");
|
|
31539
|
+
cell.removeAttribute("headers");
|
|
31540
|
+
cell.removeAttribute("abbr");
|
|
31541
|
+
if (cell.nodeName === "TH") {
|
|
31542
|
+
var td = rename(cell, "td");
|
|
31543
|
+
converted.push(td);
|
|
31544
|
+
}
|
|
31545
|
+
}
|
|
31546
|
+
if (headerMemory && converted.length) headerMemory.set(table, converted);
|
|
31547
|
+
|
|
31548
|
+
// <thead> on a layout table is harmless to AT once role=presentation is
|
|
31549
|
+
// set, but it makes the markup lie to the next human who reads it.
|
|
31550
|
+
var thead = firstOwnChild(table, "thead");
|
|
31551
|
+
if (thead) unwrapSection(table, thead);
|
|
31552
|
+
|
|
31553
|
+
fireChange();
|
|
31554
|
+
return table;
|
|
31555
|
+
}
|
|
31556
|
+
|
|
31557
|
+
function toData(table, options) {
|
|
31558
|
+
table.removeAttribute("role");
|
|
31559
|
+
|
|
31560
|
+
var restored = headerMemory ? headerMemory.get(table) : null;
|
|
31561
|
+
var promoted = false;
|
|
31562
|
+
if (restored && restored.length) {
|
|
31563
|
+
for (var i = 0; i < restored.length; i++) {
|
|
31564
|
+
var cell = restored[i];
|
|
31565
|
+
// The cell may have been deleted, or the whole table replaced,
|
|
31566
|
+
// since it was remembered.
|
|
31567
|
+
if (cell && cell.parentNode && contains(table, cell)) {
|
|
31568
|
+
rename(cell, "th");
|
|
31569
|
+
promoted = true;
|
|
31570
|
+
}
|
|
31571
|
+
}
|
|
31572
|
+
headerMemory["delete"](table);
|
|
31573
|
+
}
|
|
31574
|
+
if (!promoted && options && options.promoteFirstRow) promoteFirstRow(table);
|
|
31575
|
+
|
|
31576
|
+
fireChange();
|
|
31577
|
+
return table;
|
|
31578
|
+
}
|
|
31579
|
+
|
|
31580
|
+
function promoteFirstRow(table) {
|
|
31581
|
+
var rows = ownRows(table);
|
|
31582
|
+
if (!rows.length) return;
|
|
31583
|
+
var cells = rowCells(rows[0]);
|
|
31584
|
+
for (var i = 0; i < cells.length; i++) {
|
|
31585
|
+
var th = rename(cells[i], "th");
|
|
31586
|
+
th.setAttribute("scope", "col");
|
|
31587
|
+
}
|
|
31588
|
+
}
|
|
31589
|
+
|
|
31590
|
+
// ------------------------------------------------------------------ helpers
|
|
31591
|
+
|
|
31592
|
+
function isLayout(table) {
|
|
31593
|
+
if (!table || table.nodeName !== "TABLE") return false;
|
|
31594
|
+
var role = String(table.getAttribute("role") || "").toLowerCase();
|
|
31595
|
+
return role === "presentation" || role === "none";
|
|
31596
|
+
}
|
|
31597
|
+
|
|
31598
|
+
// Tables nest: only touch nodes whose nearest ancestor table is this one.
|
|
31599
|
+
function ownsNode(table, node) {
|
|
31600
|
+
var n = node.parentNode;
|
|
31601
|
+
while (n && n !== table) {
|
|
31602
|
+
if (n.nodeName === "TABLE") return false;
|
|
31603
|
+
n = n.parentNode;
|
|
31604
|
+
}
|
|
31605
|
+
return n === table;
|
|
31606
|
+
}
|
|
31607
|
+
|
|
31608
|
+
function ownCells(table) {
|
|
31609
|
+
var out = [], all = table.querySelectorAll ? table.querySelectorAll("th,td") : [];
|
|
31610
|
+
for (var i = 0; i < all.length; i++) if (ownsNode(table, all[i])) out.push(all[i]);
|
|
31611
|
+
return out;
|
|
31612
|
+
}
|
|
31613
|
+
|
|
31614
|
+
function ownRows(table) {
|
|
31615
|
+
var out = [], all = table.querySelectorAll ? table.querySelectorAll("tr") : [];
|
|
31616
|
+
for (var i = 0; i < all.length; i++) if (ownsNode(table, all[i])) out.push(all[i]);
|
|
31617
|
+
return out;
|
|
31618
|
+
}
|
|
31619
|
+
|
|
31620
|
+
function rowCells(row) {
|
|
31621
|
+
var out = [];
|
|
31622
|
+
for (var n = row.firstChild; n; n = n.nextSibling) {
|
|
31623
|
+
if (n.nodeName === "TH" || n.nodeName === "TD") out.push(n);
|
|
31624
|
+
}
|
|
31625
|
+
return out;
|
|
31626
|
+
}
|
|
31627
|
+
|
|
31628
|
+
function firstOwnChild(table, name) {
|
|
31629
|
+
name = name.toUpperCase();
|
|
31630
|
+
for (var n = table.firstChild; n; n = n.nextSibling) if (n.nodeName === name) return n;
|
|
31631
|
+
return null;
|
|
31632
|
+
}
|
|
31633
|
+
|
|
31634
|
+
function contains(root, node) {
|
|
31635
|
+
var n = node;
|
|
31636
|
+
while (n) { if (n === root) return true; n = n.parentNode; }
|
|
31637
|
+
return false;
|
|
31638
|
+
}
|
|
31639
|
+
|
|
31640
|
+
// Move a <thead>'s rows into the table body and drop the section.
|
|
31641
|
+
function unwrapSection(table, section) {
|
|
31642
|
+
var body = firstOwnChild(table, "tbody");
|
|
31643
|
+
if (!body) {
|
|
31644
|
+
body = table.ownerDocument.createElement("tbody");
|
|
31645
|
+
table.insertBefore(body, section.nextSibling);
|
|
31646
|
+
}
|
|
31647
|
+
while (section.firstChild) body.insertBefore(section.firstChild, body.firstChild);
|
|
31648
|
+
section.parentNode.removeChild(section);
|
|
31649
|
+
}
|
|
31650
|
+
|
|
31651
|
+
// Replace an element with the same content and attributes under a new tag.
|
|
31652
|
+
// The caret may be inside it, so the range is restored afterwards.
|
|
31653
|
+
function rename(el, tagName) {
|
|
31654
|
+
var doc = el.ownerDocument;
|
|
31655
|
+
var replacement = doc.createElement(tagName);
|
|
31656
|
+
for (var i = 0; i < el.attributes.length; i++) {
|
|
31657
|
+
var a = el.attributes[i];
|
|
31658
|
+
try { replacement.setAttribute(a.name, a.value); } catch (e) {}
|
|
31659
|
+
}
|
|
31660
|
+
while (el.firstChild) replacement.appendChild(el.firstChild);
|
|
31661
|
+
el.parentNode.replaceChild(replacement, el);
|
|
31662
|
+
return replacement;
|
|
31663
|
+
}
|
|
31664
|
+
|
|
31665
|
+
function tableAtCaret() {
|
|
31666
|
+
var ed = getEditable();
|
|
31667
|
+
if (!ed) return null;
|
|
31668
|
+
var node = null;
|
|
31669
|
+
try {
|
|
31670
|
+
var sel = editor.getSelection();
|
|
31671
|
+
if (sel && sel.rangeCount) node = sel.getRangeAt(0).startContainer;
|
|
31672
|
+
} catch (e) {}
|
|
31673
|
+
if (!node) return null;
|
|
31674
|
+
if (node.nodeType === 3) node = node.parentNode;
|
|
31675
|
+
while (node && node !== ed) {
|
|
31676
|
+
if (node.nodeName === "TABLE") return node;
|
|
31677
|
+
node = node.parentNode;
|
|
31678
|
+
}
|
|
31679
|
+
return null;
|
|
31680
|
+
}
|
|
31681
|
+
|
|
31682
|
+
function insertAtCaret(node, doc) {
|
|
31683
|
+
var inserted = false;
|
|
31684
|
+
try {
|
|
31685
|
+
var sel = editor.getSelection();
|
|
31686
|
+
if (sel && sel.rangeCount) {
|
|
31687
|
+
var range = sel.getRangeAt(0);
|
|
31688
|
+
range.deleteContents();
|
|
31689
|
+
range.insertNode(node);
|
|
31690
|
+
inserted = true;
|
|
31691
|
+
}
|
|
31692
|
+
} catch (e) {}
|
|
31693
|
+
if (!inserted) {
|
|
31694
|
+
var ed = getEditable();
|
|
31695
|
+
if (ed) { ed.appendChild(node); inserted = true; }
|
|
31696
|
+
}
|
|
31697
|
+
// A table at the very end of the document is a caret trap; gapcursor.js
|
|
31698
|
+
// handles escaping it, so nothing is appended here.
|
|
31699
|
+
return inserted;
|
|
31700
|
+
}
|
|
31701
|
+
|
|
31702
|
+
function getEditable() { try { return editor.getEditable(); } catch (e) { return null; } }
|
|
31703
|
+
|
|
31704
|
+
function editableDoc() {
|
|
31705
|
+
var ed = getEditable();
|
|
31706
|
+
return ed ? ed.ownerDocument : null;
|
|
31707
|
+
}
|
|
31708
|
+
|
|
31709
|
+
function injectStyles(doc) {
|
|
31710
|
+
if (!doc) return;
|
|
31711
|
+
var text = outlineOn
|
|
31712
|
+
? "table[role=presentation]{outline:1px dashed rgba(120,120,140,.55);outline-offset:1px;}" +
|
|
31713
|
+
"table[role=presentation] td{outline:1px dashed rgba(120,120,140,.28);}"
|
|
31714
|
+
: "";
|
|
31715
|
+
var existing = doc.getElementById("rte-layout-table-styles");
|
|
31716
|
+
if (existing) {
|
|
31717
|
+
if (existing.getAttribute("data-css") === text) return;
|
|
31718
|
+
existing.parentNode && existing.parentNode.removeChild(existing);
|
|
31719
|
+
}
|
|
31720
|
+
if (!text) return;
|
|
31721
|
+
var st = doc.createElement("style");
|
|
31722
|
+
st.id = "rte-layout-table-styles";
|
|
31723
|
+
st.setAttribute("data-css", text);
|
|
31724
|
+
st.appendChild(doc.createTextNode(text));
|
|
31725
|
+
(doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement).appendChild(st);
|
|
31726
|
+
}
|
|
31727
|
+
|
|
31728
|
+
function fireChange() {
|
|
31729
|
+
try { if (typeof editor.updateDesign === "function") editor.updateDesign(); } catch (e) {}
|
|
31730
|
+
try { if (typeof editor.fireChange === "function") editor.fireChange(); } catch (e) {}
|
|
31731
|
+
}
|
|
31732
|
+
}
|
|
31733
|
+
|
|
31734
|
+
if (!window.RTE_DefaultConfig) window.RTE_DefaultConfig = {};
|
|
31735
|
+
|
|
31277
31736
|
// 2026-07-27 Margin line numbers. Numbers every visual line in the left gutter,
|
|
31278
31737
|
// the way a word processor does for pleadings, statutes, transcripts and any
|
|
31279
31738
|
// document people cite by line ("page 4, lines 12-15").
|
|
@@ -37880,6 +38339,259 @@ function RTE_Plugin_Sanitizer() {
|
|
|
37880
38339
|
|
|
37881
38340
|
if (!window.RTE_DefaultConfig) window.RTE_DefaultConfig = {};
|
|
37882
38341
|
|
|
38342
|
+
// 2026-08-30 Shadow DOM support — make the editor usable inside a shadow root.
|
|
38343
|
+
//
|
|
38344
|
+
// TinyMCE documents shadow-DOM support as a supported integration; we had none
|
|
38345
|
+
// under any name. Design systems, micro-frontends and anything built as a custom
|
|
38346
|
+
// element put their markup inside a shadow root, and that is where this editor
|
|
38347
|
+
// was quietly broken.
|
|
38348
|
+
//
|
|
38349
|
+
// Measured before writing a line of it, on a real instance in Chromium:
|
|
38350
|
+
//
|
|
38351
|
+
// | mounted in | toolbar height | font |
|
|
38352
|
+
// |-----------------------|----------------|-------------------|
|
|
38353
|
+
// | the page (light DOM) | 82 px | system-ui |
|
|
38354
|
+
// | a shadow root | 45,468 px | Times New Roman |
|
|
38355
|
+
//
|
|
38356
|
+
// So it is not "mostly fine". The editor CONSTRUCTS, the iframe appears, and
|
|
38357
|
+
// setHTMLCode/getHTMLCode round-trip correctly — which is exactly why this was
|
|
38358
|
+
// never noticed — but a style boundary is a wall: `<link rel=stylesheet>` in the
|
|
38359
|
+
// document head does not cross into a shadow root, so every rule in
|
|
38360
|
+
// rte_theme_default.css misses, and the toolbar renders as a 45,000-pixel column
|
|
38361
|
+
// of unstyled buttons.
|
|
38362
|
+
//
|
|
38363
|
+
// The fix is to put the editor's own stylesheets on the inside of the wall too.
|
|
38364
|
+
//
|
|
38365
|
+
// Design notes:
|
|
38366
|
+
// - <link> clones, not fetch + CSSStyleSheet. Constructing a stylesheet means
|
|
38367
|
+
// fetching the CSS with JS, which needs CORS on a CDN-hosted theme and fails
|
|
38368
|
+
// closed — a cloned <link> hits the HTTP cache, needs no CORS, and works on
|
|
38369
|
+
// every browser that has shadow DOM at all. adoptedStyleSheets is used only
|
|
38370
|
+
// for sheets already adopted by the document, which have no URL to clone.
|
|
38371
|
+
// - Only the EDITOR's stylesheets are copied. Cloning the whole head into a
|
|
38372
|
+
// shadow root would undo the encapsulation the integrator chose it for. A
|
|
38373
|
+
// sheet counts as ours by origin — served from the folder rte.js was loaded
|
|
38374
|
+
// from — plus an `rte-`/`__rte` element id, the same origin-based test that
|
|
38375
|
+
// importstyles.js had to arrive at after prefix matching failed.
|
|
38376
|
+
// - A MutationObserver keeps watching the head. Plugins inject their styles
|
|
38377
|
+
// lazily, when their panel first opens — the accessibility checker and the AI
|
|
38378
|
+
// toolkit both do — so a one-shot copy at init produces a styled toolbar and
|
|
38379
|
+
// an unstyled dialog half an hour later, which is a worse bug to diagnose
|
|
38380
|
+
// than a wholly unstyled editor.
|
|
38381
|
+
// - Nothing is copied when the editor is NOT in a shadow root, and the
|
|
38382
|
+
// observer is not even created. This plugin must cost nothing for the 99%.
|
|
38383
|
+
RTE_DefaultConfig.plugin_shadowdom = RTE_Plugin_ShadowDom;
|
|
38384
|
+
|
|
38385
|
+
// Copy the editor's stylesheets into the shadow root that contains it.
|
|
38386
|
+
if (typeof RTE_DefaultConfig.shadowStyleAdoption === "undefined") RTE_DefaultConfig.shadowStyleAdoption = true;
|
|
38387
|
+
// Extra stylesheet URLs to copy in as well (an integrator's own skin overrides).
|
|
38388
|
+
if (typeof RTE_DefaultConfig.shadowStyleSources === "undefined") RTE_DefaultConfig.shadowStyleSources = null;
|
|
38389
|
+
|
|
38390
|
+
function RTE_Plugin_ShadowDom() {
|
|
38391
|
+
var obj = this;
|
|
38392
|
+
var config, editor;
|
|
38393
|
+
var root = null;
|
|
38394
|
+
var observer = null;
|
|
38395
|
+
var copied = null;
|
|
38396
|
+
|
|
38397
|
+
obj.PluginName = "ShadowDom";
|
|
38398
|
+
|
|
38399
|
+
obj.InitConfig = function (argconfig) { config = argconfig; };
|
|
38400
|
+
|
|
38401
|
+
obj.InitEditor = function (argeditor) {
|
|
38402
|
+
editor = argeditor;
|
|
38403
|
+
|
|
38404
|
+
// Public API — useful even outside a shadow root, for a host page that
|
|
38405
|
+
// wants to style a second root (a dialog portal, a preview pane).
|
|
38406
|
+
editor.getShadowRoot = function () { return findRoot(); };
|
|
38407
|
+
editor.isInShadowDom = function () { return !!findRoot(); };
|
|
38408
|
+
editor.adoptEditorStyles = function (target) { return adopt(target || findRoot(), true); };
|
|
38409
|
+
editor.getAdoptedStyleCount = function () { return copied ? copied.size : 0; };
|
|
38410
|
+
|
|
38411
|
+
if (config && config.shadowStyleAdoption === false) return;
|
|
38412
|
+
|
|
38413
|
+
// The chrome is built asynchronously; the container may not exist yet.
|
|
38414
|
+
whenReady(function () {
|
|
38415
|
+
root = findRoot();
|
|
38416
|
+
if (!root) return;
|
|
38417
|
+
copied = new (window.Set || Array)();
|
|
38418
|
+
adopt(root, false);
|
|
38419
|
+
watchHead(root);
|
|
38420
|
+
});
|
|
38421
|
+
};
|
|
38422
|
+
|
|
38423
|
+
obj.Destroy = function () {
|
|
38424
|
+
if (observer) { try { observer.disconnect(); } catch (e) {} observer = null; }
|
|
38425
|
+
};
|
|
38426
|
+
|
|
38427
|
+
// ------------------------------------------------------------------ lookup
|
|
38428
|
+
|
|
38429
|
+
// The editor's container is the element the integrator passed in; from the
|
|
38430
|
+
// editing iframe it is the nearest ancestor carrying the editor's own class.
|
|
38431
|
+
function container() {
|
|
38432
|
+
try {
|
|
38433
|
+
var editable = editor.getEditable();
|
|
38434
|
+
var frame = editable && editable.ownerDocument && editable.ownerDocument.defaultView
|
|
38435
|
+
? editable.ownerDocument.defaultView.frameElement : null;
|
|
38436
|
+
if (!frame) return null;
|
|
38437
|
+
var node = frame;
|
|
38438
|
+
while (node) {
|
|
38439
|
+
if (node.classList && node.classList.contains("richtexteditor")) return node;
|
|
38440
|
+
node = node.parentNode || node.host;
|
|
38441
|
+
}
|
|
38442
|
+
return frame;
|
|
38443
|
+
}
|
|
38444
|
+
catch (e) { return null; }
|
|
38445
|
+
}
|
|
38446
|
+
|
|
38447
|
+
function findRoot() {
|
|
38448
|
+
var el = container();
|
|
38449
|
+
if (!el || typeof el.getRootNode !== "function") return null;
|
|
38450
|
+
var r = el.getRootNode();
|
|
38451
|
+
// A DocumentFragment with a `host` is a shadow root; a plain document is not.
|
|
38452
|
+
return (r && r.host && r !== document) ? r : null;
|
|
38453
|
+
}
|
|
38454
|
+
|
|
38455
|
+
function whenReady(callback) {
|
|
38456
|
+
if (container()) { callback(); return; }
|
|
38457
|
+
var tries = 0;
|
|
38458
|
+
var timer = window.setInterval(function () {
|
|
38459
|
+
if (container() || ++tries > 100) { window.clearInterval(timer); callback(); }
|
|
38460
|
+
}, 50);
|
|
38461
|
+
}
|
|
38462
|
+
|
|
38463
|
+
// ------------------------------------------------------------------ adopt
|
|
38464
|
+
|
|
38465
|
+
// Where rte.js itself was served from. Everything under that folder is ours.
|
|
38466
|
+
function assetBase() {
|
|
38467
|
+
try {
|
|
38468
|
+
var scripts = document.getElementsByTagName("script");
|
|
38469
|
+
for (var i = 0; i < scripts.length; i++) {
|
|
38470
|
+
var src = scripts[i].src || "";
|
|
38471
|
+
if (/(^|\/)rte(\.min)?\.js(\?|$)/.test(src)) return src.replace(/[^\/]*$/, "");
|
|
38472
|
+
}
|
|
38473
|
+
}
|
|
38474
|
+
catch (e) {}
|
|
38475
|
+
return null;
|
|
38476
|
+
}
|
|
38477
|
+
|
|
38478
|
+
function isOurs(node) {
|
|
38479
|
+
var id = String(node.id || "");
|
|
38480
|
+
if (/^rte[-_]|^__rte/.test(id)) return true;
|
|
38481
|
+
var href = node.href || "";
|
|
38482
|
+
if (!href) return false;
|
|
38483
|
+
var base = assetBase();
|
|
38484
|
+
if (base && href.indexOf(base) === 0) return true;
|
|
38485
|
+
// Fall back to the file names this product actually ships, so an
|
|
38486
|
+
// integrator who renamed or re-hosted the folder still gets styled
|
|
38487
|
+
// chrome rather than a silent 45,000-pixel toolbar.
|
|
38488
|
+
return /rte_theme|rte_mobile|richtexteditor_content|richtexteditor_preview|aitoolkit/.test(href);
|
|
38489
|
+
}
|
|
38490
|
+
|
|
38491
|
+
function extraSources() {
|
|
38492
|
+
var list = (config && config.shadowStyleSources) || null;
|
|
38493
|
+
if (!list) return [];
|
|
38494
|
+
return typeof list === "string" ? [list] : list;
|
|
38495
|
+
}
|
|
38496
|
+
|
|
38497
|
+
function key(node) {
|
|
38498
|
+
return (node.href || "") + "|" + (node.id || "") + "|" + (node.textContent || "").length;
|
|
38499
|
+
}
|
|
38500
|
+
|
|
38501
|
+
function has(k) {
|
|
38502
|
+
return copied && (copied.has ? copied.has(k) : copied.indexOf(k) >= 0);
|
|
38503
|
+
}
|
|
38504
|
+
|
|
38505
|
+
function remember(k) {
|
|
38506
|
+
if (!copied) return;
|
|
38507
|
+
if (copied.add) copied.add(k); else copied.push(k);
|
|
38508
|
+
}
|
|
38509
|
+
|
|
38510
|
+
function adopt(target, force) {
|
|
38511
|
+
if (!target) return 0;
|
|
38512
|
+
if (!copied) copied = new (window.Set || Array)();
|
|
38513
|
+
var added = 0;
|
|
38514
|
+
var nodes = document.querySelectorAll("link[rel~=stylesheet],style");
|
|
38515
|
+
|
|
38516
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
38517
|
+
var node = nodes[i];
|
|
38518
|
+
if (!isOurs(node)) continue;
|
|
38519
|
+
var k = key(node);
|
|
38520
|
+
if (!force && has(k)) continue;
|
|
38521
|
+
if (has(k)) continue;
|
|
38522
|
+
target.appendChild(cloneSheet(node, target));
|
|
38523
|
+
remember(k);
|
|
38524
|
+
added++;
|
|
38525
|
+
}
|
|
38526
|
+
|
|
38527
|
+
var extras = extraSources();
|
|
38528
|
+
for (var e = 0; e < extras.length; e++) {
|
|
38529
|
+
var ek = "extra|" + extras[e];
|
|
38530
|
+
if (has(ek)) continue;
|
|
38531
|
+
var link = document.createElement("link");
|
|
38532
|
+
link.rel = "stylesheet";
|
|
38533
|
+
link.href = extras[e];
|
|
38534
|
+
link.setAttribute("data-rte-adopted", "1");
|
|
38535
|
+
target.appendChild(link);
|
|
38536
|
+
remember(ek);
|
|
38537
|
+
added++;
|
|
38538
|
+
}
|
|
38539
|
+
|
|
38540
|
+
// Sheets the page adopted programmatically have no URL to clone, so they
|
|
38541
|
+
// are re-adopted by reference where the browser supports it.
|
|
38542
|
+
try {
|
|
38543
|
+
if (target.adoptedStyleSheets && document.adoptedStyleSheets && document.adoptedStyleSheets.length) {
|
|
38544
|
+
var merged = target.adoptedStyleSheets.slice();
|
|
38545
|
+
for (var a = 0; a < document.adoptedStyleSheets.length; a++) {
|
|
38546
|
+
if (merged.indexOf(document.adoptedStyleSheets[a]) < 0) merged.push(document.adoptedStyleSheets[a]);
|
|
38547
|
+
}
|
|
38548
|
+
target.adoptedStyleSheets = merged;
|
|
38549
|
+
}
|
|
38550
|
+
}
|
|
38551
|
+
catch (e2) {}
|
|
38552
|
+
|
|
38553
|
+
return added;
|
|
38554
|
+
}
|
|
38555
|
+
|
|
38556
|
+
function cloneSheet(node, target) {
|
|
38557
|
+
if (node.tagName === "LINK") {
|
|
38558
|
+
var link = document.createElement("link");
|
|
38559
|
+
link.rel = "stylesheet";
|
|
38560
|
+
// Resolved (absolute) href — a relative one would resolve against the
|
|
38561
|
+
// document anyway, but being explicit survives a <base> element.
|
|
38562
|
+
link.href = node.href;
|
|
38563
|
+
if (node.media) link.media = node.media;
|
|
38564
|
+
link.setAttribute("data-rte-adopted", "1");
|
|
38565
|
+
return link;
|
|
38566
|
+
}
|
|
38567
|
+
var style = document.createElement("style");
|
|
38568
|
+
style.textContent = node.textContent;
|
|
38569
|
+
if (node.id) style.setAttribute("data-rte-source-id", node.id);
|
|
38570
|
+
style.setAttribute("data-rte-adopted", "1");
|
|
38571
|
+
return style;
|
|
38572
|
+
}
|
|
38573
|
+
|
|
38574
|
+
// A plugin's <style> arrives when its panel first opens, long after init.
|
|
38575
|
+
function watchHead(target) {
|
|
38576
|
+
if (!window.MutationObserver) return;
|
|
38577
|
+
observer = new MutationObserver(function (records) {
|
|
38578
|
+
var interesting = false;
|
|
38579
|
+
for (var i = 0; i < records.length && !interesting; i++) {
|
|
38580
|
+
var added = records[i].addedNodes || [];
|
|
38581
|
+
for (var j = 0; j < added.length; j++) {
|
|
38582
|
+
var n = added[j];
|
|
38583
|
+
if (n.nodeType !== 1) continue;
|
|
38584
|
+
if ((n.tagName === "STYLE" || n.tagName === "LINK") && isOurs(n)) { interesting = true; break; }
|
|
38585
|
+
}
|
|
38586
|
+
}
|
|
38587
|
+
if (interesting) adopt(target, false);
|
|
38588
|
+
});
|
|
38589
|
+
observer.observe(document.head || document.documentElement, { childList: true, subtree: true });
|
|
38590
|
+
}
|
|
38591
|
+
}
|
|
38592
|
+
|
|
38593
|
+
if (!window.RTE_DefaultConfig) window.RTE_DefaultConfig = {};
|
|
38594
|
+
|
|
37883
38595
|
RTE_DefaultConfig.plugin_slashcommand = RTE_Plugin_SlashCommand;
|
|
37884
38596
|
|
|
37885
38597
|
function RTE_Plugin_SlashCommand() {
|
|
@@ -38125,6 +38837,14 @@ function RTE_Plugin_SlashCommand() {
|
|
|
38125
38837
|
push("Tools", "tablerownumbers", "Number table rows", "Add or remove an automatic row-numbering column", ["number", "rows", "table", "count", "index"], iconSort(),
|
|
38126
38838
|
function () { editor.execCommand("tablerownumbers"); });
|
|
38127
38839
|
}
|
|
38840
|
+
if (typeof editor.setTableLayoutMode === "function") {
|
|
38841
|
+
push("Insert", "layouttable", "Layout table", "Insert a borderless table for positioning content (role=presentation)", ["layout", "table", "grid", "email", "columns", "presentation"], iconTable(),
|
|
38842
|
+
function () { editor.insertLayoutTable(2, 2); });
|
|
38843
|
+
push("Tools", "tablelayoutmode", "Mark table as layout", "This table only positions content — stop screen readers announcing it as data", ["layout", "table", "presentation", "accessibility", "screen reader"], iconTable(),
|
|
38844
|
+
function () { editor.setTableLayoutMode("layout"); });
|
|
38845
|
+
push("Tools", "tabledatamode", "Mark table as data", "This table states relationships — restore its header cells", ["data", "table", "header", "accessibility"], iconTable(),
|
|
38846
|
+
function () { editor.setTableLayoutMode("data", null, { promoteFirstRow: true }); });
|
|
38847
|
+
}
|
|
38128
38848
|
if (typeof editor.moveBlockUp === "function") {
|
|
38129
38849
|
push("Tools", "moveblockup", "Move block up", "Move this paragraph or block above the previous one (Alt+Shift+Up)", ["move", "block", "up", "reorder", "drag"], iconMoveBlock(),
|
|
38130
38850
|
function () { editor.moveBlockUp(); });
|