@uipath/apollo-react 4.39.5 → 4.41.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/dist/canvas/components/StageNode/StageNode.styles.cjs +4 -2
- package/dist/canvas/components/StageNode/StageNode.styles.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.styles.js +4 -2
- package/dist/canvas/components/StageNode/StageNode.types.cjs +2 -0
- package/dist/canvas/components/StageNode/StageNode.types.d.ts +4 -1
- package/dist/canvas/components/StageNode/StageNode.types.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.types.js +2 -0
- package/dist/canvas/components/StageNode/StageNodeHeader.cjs +52 -4
- package/dist/canvas/components/StageNode/StageNodeHeader.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNodeHeader.js +52 -4
- package/dist/canvas/components/StageNode/useStageNodeLabels.cjs +8 -0
- package/dist/canvas/components/StageNode/useStageNodeLabels.d.ts +2 -0
- package/dist/canvas/components/StageNode/useStageNodeLabels.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/useStageNodeLabels.js +8 -0
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/material/components/ap-rich-text-editor/ApRichTextEditor.cjs +297 -0
- package/dist/material/components/ap-rich-text-editor/ApRichTextEditor.css +535 -0
- package/dist/material/components/ap-rich-text-editor/ApRichTextEditor.d.ts +5 -0
- package/dist/material/components/ap-rich-text-editor/ApRichTextEditor.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/ApRichTextEditor.js +250 -0
- package/dist/material/components/ap-rich-text-editor/ApRichTextEditor.types.cjs +18 -0
- package/dist/material/components/ap-rich-text-editor/ApRichTextEditor.types.d.ts +18 -0
- package/dist/material/components/ap-rich-text-editor/ApRichTextEditor.types.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/ApRichTextEditor.types.js +0 -0
- package/dist/material/components/ap-rich-text-editor/index.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/index.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/index.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/index.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/de.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/de.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/de.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/de.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/en.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/en.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/en.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/en.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/es-MX.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/es-MX.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/es-MX.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/es-MX.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/es.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/es.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/es.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/es.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/fr.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/fr.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/fr.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/fr.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/ja.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/ja.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/ja.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/ja.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/ko.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/ko.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/ko.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/ko.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/pt-BR.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/pt-BR.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/pt-BR.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/pt-BR.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/pt.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/pt.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/pt.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/pt.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/ru.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/ru.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/ru.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/ru.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/tr.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/tr.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/tr.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/tr.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/zh-CN.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/zh-CN.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/zh-CN.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/zh-CN.js +2 -0
- package/dist/material/components/ap-rich-text-editor/locales/zh-TW.cjs +36 -0
- package/dist/material/components/ap-rich-text-editor/locales/zh-TW.d.ts +3 -0
- package/dist/material/components/ap-rich-text-editor/locales/zh-TW.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/locales/zh-TW.js +2 -0
- package/dist/material/components/ap-rich-text-editor/plugins/AutoLinkPlugin.cjs +64 -0
- package/dist/material/components/ap-rich-text-editor/plugins/AutoLinkPlugin.d.ts +2 -0
- package/dist/material/components/ap-rich-text-editor/plugins/AutoLinkPlugin.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/plugins/AutoLinkPlugin.js +30 -0
- package/dist/material/components/ap-rich-text-editor/plugins/CodeHighlightPlugin.cjs +45 -0
- package/dist/material/components/ap-rich-text-editor/plugins/CodeHighlightPlugin.d.ts +2 -0
- package/dist/material/components/ap-rich-text-editor/plugins/CodeHighlightPlugin.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/plugins/CodeHighlightPlugin.js +11 -0
- package/dist/material/components/ap-rich-text-editor/plugins/MarkdownTransformers.cjs +187 -0
- package/dist/material/components/ap-rich-text-editor/plugins/MarkdownTransformers.d.ts +2 -0
- package/dist/material/components/ap-rich-text-editor/plugins/MarkdownTransformers.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/plugins/MarkdownTransformers.js +153 -0
- package/dist/material/components/ap-rich-text-editor/plugins/ToolbarPlugin.cjs +306 -0
- package/dist/material/components/ap-rich-text-editor/plugins/ToolbarPlugin.d.ts +4 -0
- package/dist/material/components/ap-rich-text-editor/plugins/ToolbarPlugin.d.ts.map +1 -0
- package/dist/material/components/ap-rich-text-editor/plugins/ToolbarPlugin.js +272 -0
- package/dist/material/components/index.cjs +23 -16
- package/dist/material/components/index.d.ts +1 -0
- package/dist/material/components/index.d.ts.map +1 -1
- package/dist/material/components/index.js +1 -0
- package/package.json +12 -1
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
RTE_TRANSFORMERS: ()=>RTE_TRANSFORMERS
|
|
28
|
+
});
|
|
29
|
+
const markdown_namespaceObject = require("@lexical/markdown");
|
|
30
|
+
const table_namespaceObject = require("@lexical/table");
|
|
31
|
+
const external_lexical_namespaceObject = require("lexical");
|
|
32
|
+
const UNDERLINE_EXPORTER_AND_TRANSFORMER = {
|
|
33
|
+
dependencies: [
|
|
34
|
+
external_lexical_namespaceObject.TextNode
|
|
35
|
+
],
|
|
36
|
+
export: (node, _, exportFormat)=>{
|
|
37
|
+
if ((0, external_lexical_namespaceObject.$isTextNode)(node) && node.hasFormat('underline')) return '<u>' + exportFormat(node, node.getTextContent()) + '</u>';
|
|
38
|
+
return null;
|
|
39
|
+
},
|
|
40
|
+
importRegExp: /<u>(.*?)<\/u>/,
|
|
41
|
+
regExp: /<u>(.*?)<\/u>$/,
|
|
42
|
+
replace: (textNode, match)=>{
|
|
43
|
+
textNode.setFormat('underline');
|
|
44
|
+
textNode.setTextContent(match[1] ?? '');
|
|
45
|
+
return textNode;
|
|
46
|
+
},
|
|
47
|
+
trigger: '>',
|
|
48
|
+
type: 'text-match'
|
|
49
|
+
};
|
|
50
|
+
const UNDERLINE_IMPORTER = {
|
|
51
|
+
dependencies: [
|
|
52
|
+
external_lexical_namespaceObject.TextNode
|
|
53
|
+
],
|
|
54
|
+
export: ()=>null,
|
|
55
|
+
regExp: /<u>(.*?)<\/u>/,
|
|
56
|
+
replace: (_, children, match)=>{
|
|
57
|
+
for (const child of children)if ((0, external_lexical_namespaceObject.$isTextNode)(child)) {
|
|
58
|
+
child.setFormat('underline');
|
|
59
|
+
child.setTextContent(match[1] ?? '');
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
type: 'element'
|
|
63
|
+
};
|
|
64
|
+
const TABLE_ROW_REG_EXP = /^(?:\|)(.+)(?:\|)\s?$/;
|
|
65
|
+
const TABLE_ROW_DIVIDER_REG_EXP = /^\|(?:\s*:?-+:?\s*\|)+\s*$/;
|
|
66
|
+
const TABLE = {
|
|
67
|
+
dependencies: [
|
|
68
|
+
table_namespaceObject.TableNode,
|
|
69
|
+
table_namespaceObject.TableRowNode,
|
|
70
|
+
table_namespaceObject.TableCellNode
|
|
71
|
+
],
|
|
72
|
+
export: (node)=>{
|
|
73
|
+
if (!(0, table_namespaceObject.$isTableNode)(node)) return null;
|
|
74
|
+
const output = [];
|
|
75
|
+
for (const row of node.getChildren()){
|
|
76
|
+
const rowOutput = [];
|
|
77
|
+
if (!(0, table_namespaceObject.$isTableRowNode)(row)) continue;
|
|
78
|
+
let isHeaderRow = false;
|
|
79
|
+
for (const cell of row.getChildren())if ((0, table_namespaceObject.$isTableCellNode)(cell)) {
|
|
80
|
+
rowOutput.push((0, markdown_namespaceObject.$convertToMarkdownString)(RTE_TRANSFORMERS, cell).replace(/\n/g, '\\n'));
|
|
81
|
+
if (cell.__headerState === table_namespaceObject.TableCellHeaderStates.ROW) isHeaderRow = true;
|
|
82
|
+
}
|
|
83
|
+
output.push(`| ${rowOutput.join(' | ')} |`);
|
|
84
|
+
if (isHeaderRow) output.push(`| ${rowOutput.map(()=>'---').join(' | ')} |`);
|
|
85
|
+
}
|
|
86
|
+
return output.join('\n');
|
|
87
|
+
},
|
|
88
|
+
regExp: TABLE_ROW_REG_EXP,
|
|
89
|
+
replace: (parentNode, _1, match)=>{
|
|
90
|
+
const matchText = match[0] ?? '';
|
|
91
|
+
if (TABLE_ROW_DIVIDER_REG_EXP.test(matchText)) {
|
|
92
|
+
const table = parentNode.getPreviousSibling();
|
|
93
|
+
if (!table || !(0, table_namespaceObject.$isTableNode)(table)) return;
|
|
94
|
+
const rows = table.getChildren();
|
|
95
|
+
const lastRow = rows[rows.length - 1];
|
|
96
|
+
if (!lastRow || !(0, table_namespaceObject.$isTableRowNode)(lastRow)) return;
|
|
97
|
+
convertToHeaderCells(lastRow.getChildren());
|
|
98
|
+
parentNode.remove();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const matchCells = mapToTableCells(matchText);
|
|
102
|
+
if (null == matchCells) return;
|
|
103
|
+
const rows = [
|
|
104
|
+
matchCells
|
|
105
|
+
];
|
|
106
|
+
let sibling = parentNode.getPreviousSibling();
|
|
107
|
+
let maxCells = matchCells.length;
|
|
108
|
+
let isHeaderRow = false;
|
|
109
|
+
while(sibling){
|
|
110
|
+
if (!(0, external_lexical_namespaceObject.$isParagraphNode)(sibling)) break;
|
|
111
|
+
if (1 !== sibling.getChildrenSize()) break;
|
|
112
|
+
const firstChild = sibling.getFirstChild();
|
|
113
|
+
if (!(0, external_lexical_namespaceObject.$isTextNode)(firstChild)) break;
|
|
114
|
+
if (TABLE_ROW_DIVIDER_REG_EXP.test(firstChild.getTextContent())) isHeaderRow = true;
|
|
115
|
+
else {
|
|
116
|
+
const cells = mapToTableCells(firstChild.getTextContent());
|
|
117
|
+
if (null == cells) break;
|
|
118
|
+
if (isHeaderRow) {
|
|
119
|
+
convertToHeaderCells(cells);
|
|
120
|
+
isHeaderRow = false;
|
|
121
|
+
}
|
|
122
|
+
maxCells = Math.max(maxCells, cells.length);
|
|
123
|
+
rows.unshift(cells);
|
|
124
|
+
}
|
|
125
|
+
const previousSibling = sibling.getPreviousSibling();
|
|
126
|
+
sibling.remove();
|
|
127
|
+
sibling = previousSibling;
|
|
128
|
+
}
|
|
129
|
+
const table = (0, table_namespaceObject.$createTableNode)();
|
|
130
|
+
for (const cells of rows){
|
|
131
|
+
const tableRow = (0, table_namespaceObject.$createTableRowNode)();
|
|
132
|
+
table.append(tableRow);
|
|
133
|
+
tableRow.append(...cells);
|
|
134
|
+
const lenDiff = maxCells - cells.length;
|
|
135
|
+
const isInHeaderRow = cells[0]?.__headerState === table_namespaceObject.TableCellHeaderStates.ROW;
|
|
136
|
+
for(let i = 0; i < lenDiff; i++){
|
|
137
|
+
const newCell = $createTableCell('');
|
|
138
|
+
if (isInHeaderRow) newCell.toggleHeaderStyle(table_namespaceObject.TableCellHeaderStates.ROW);
|
|
139
|
+
tableRow.append(newCell);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const previousSibling = parentNode.getPreviousSibling();
|
|
143
|
+
if ((0, table_namespaceObject.$isTableNode)(previousSibling) && getTableColumnsSize(previousSibling) === maxCells) {
|
|
144
|
+
previousSibling.append(...table.getChildren());
|
|
145
|
+
parentNode.remove();
|
|
146
|
+
previousSibling.selectEnd();
|
|
147
|
+
} else {
|
|
148
|
+
parentNode.replace(table);
|
|
149
|
+
table.selectEnd();
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
type: 'element'
|
|
153
|
+
};
|
|
154
|
+
function getTableColumnsSize(table) {
|
|
155
|
+
const row = table.getFirstChild();
|
|
156
|
+
return (0, table_namespaceObject.$isTableRowNode)(row) ? row.getChildrenSize() : 0;
|
|
157
|
+
}
|
|
158
|
+
const $createTableCell = (textContent)=>{
|
|
159
|
+
textContent = textContent.replace(/\\r?\\n/g, '\n');
|
|
160
|
+
const cell = (0, table_namespaceObject.$createTableCellNode)(table_namespaceObject.TableCellHeaderStates.NO_STATUS);
|
|
161
|
+
(0, markdown_namespaceObject.$convertFromMarkdownString)(textContent, RTE_TRANSFORMERS, cell);
|
|
162
|
+
return cell;
|
|
163
|
+
};
|
|
164
|
+
const mapToTableCells = (textContent)=>{
|
|
165
|
+
const match = textContent.match(TABLE_ROW_REG_EXP);
|
|
166
|
+
if (!match?.[1]) return null;
|
|
167
|
+
return match[1].split('|').map((text)=>$createTableCell(text));
|
|
168
|
+
};
|
|
169
|
+
const convertToHeaderCells = (row)=>{
|
|
170
|
+
row.forEach((cell)=>{
|
|
171
|
+
if (!(0, table_namespaceObject.$isTableCellNode)(cell)) return;
|
|
172
|
+
cell.toggleHeaderStyle(table_namespaceObject.TableCellHeaderStates.ROW);
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
const RTE_TRANSFORMERS = [
|
|
176
|
+
...markdown_namespaceObject.TRANSFORMERS,
|
|
177
|
+
UNDERLINE_EXPORTER_AND_TRANSFORMER,
|
|
178
|
+
UNDERLINE_IMPORTER,
|
|
179
|
+
TABLE
|
|
180
|
+
];
|
|
181
|
+
exports.RTE_TRANSFORMERS = __webpack_exports__.RTE_TRANSFORMERS;
|
|
182
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
183
|
+
"RTE_TRANSFORMERS"
|
|
184
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
185
|
+
Object.defineProperty(exports, '__esModule', {
|
|
186
|
+
value: true
|
|
187
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownTransformers.d.ts","sourceRoot":"","sources":["../../../../../src/material/components/ap-rich-text-editor/plugins/MarkdownTransformers.tsx"],"names":[],"mappings":"AAoPA,eAAO,MAAM,gBAAgB,2CAK5B,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { $convertFromMarkdownString, $convertToMarkdownString, TRANSFORMERS } from "@lexical/markdown";
|
|
2
|
+
import { $createTableCellNode, $createTableNode, $createTableRowNode, $isTableCellNode, $isTableNode, $isTableRowNode, TableCellHeaderStates, TableCellNode, TableNode, TableRowNode } from "@lexical/table";
|
|
3
|
+
import { $isParagraphNode, $isTextNode, TextNode } from "lexical";
|
|
4
|
+
const UNDERLINE_EXPORTER_AND_TRANSFORMER = {
|
|
5
|
+
dependencies: [
|
|
6
|
+
TextNode
|
|
7
|
+
],
|
|
8
|
+
export: (node, _, exportFormat)=>{
|
|
9
|
+
if ($isTextNode(node) && node.hasFormat('underline')) return '<u>' + exportFormat(node, node.getTextContent()) + '</u>';
|
|
10
|
+
return null;
|
|
11
|
+
},
|
|
12
|
+
importRegExp: /<u>(.*?)<\/u>/,
|
|
13
|
+
regExp: /<u>(.*?)<\/u>$/,
|
|
14
|
+
replace: (textNode, match)=>{
|
|
15
|
+
textNode.setFormat('underline');
|
|
16
|
+
textNode.setTextContent(match[1] ?? '');
|
|
17
|
+
return textNode;
|
|
18
|
+
},
|
|
19
|
+
trigger: '>',
|
|
20
|
+
type: 'text-match'
|
|
21
|
+
};
|
|
22
|
+
const UNDERLINE_IMPORTER = {
|
|
23
|
+
dependencies: [
|
|
24
|
+
TextNode
|
|
25
|
+
],
|
|
26
|
+
export: ()=>null,
|
|
27
|
+
regExp: /<u>(.*?)<\/u>/,
|
|
28
|
+
replace: (_, children, match)=>{
|
|
29
|
+
for (const child of children)if ($isTextNode(child)) {
|
|
30
|
+
child.setFormat('underline');
|
|
31
|
+
child.setTextContent(match[1] ?? '');
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
type: 'element'
|
|
35
|
+
};
|
|
36
|
+
const TABLE_ROW_REG_EXP = /^(?:\|)(.+)(?:\|)\s?$/;
|
|
37
|
+
const TABLE_ROW_DIVIDER_REG_EXP = /^\|(?:\s*:?-+:?\s*\|)+\s*$/;
|
|
38
|
+
const TABLE = {
|
|
39
|
+
dependencies: [
|
|
40
|
+
TableNode,
|
|
41
|
+
TableRowNode,
|
|
42
|
+
TableCellNode
|
|
43
|
+
],
|
|
44
|
+
export: (node)=>{
|
|
45
|
+
if (!$isTableNode(node)) return null;
|
|
46
|
+
const output = [];
|
|
47
|
+
for (const row of node.getChildren()){
|
|
48
|
+
const rowOutput = [];
|
|
49
|
+
if (!$isTableRowNode(row)) continue;
|
|
50
|
+
let isHeaderRow = false;
|
|
51
|
+
for (const cell of row.getChildren())if ($isTableCellNode(cell)) {
|
|
52
|
+
rowOutput.push($convertToMarkdownString(RTE_TRANSFORMERS, cell).replace(/\n/g, '\\n'));
|
|
53
|
+
if (cell.__headerState === TableCellHeaderStates.ROW) isHeaderRow = true;
|
|
54
|
+
}
|
|
55
|
+
output.push(`| ${rowOutput.join(' | ')} |`);
|
|
56
|
+
if (isHeaderRow) output.push(`| ${rowOutput.map(()=>'---').join(' | ')} |`);
|
|
57
|
+
}
|
|
58
|
+
return output.join('\n');
|
|
59
|
+
},
|
|
60
|
+
regExp: TABLE_ROW_REG_EXP,
|
|
61
|
+
replace: (parentNode, _1, match)=>{
|
|
62
|
+
const matchText = match[0] ?? '';
|
|
63
|
+
if (TABLE_ROW_DIVIDER_REG_EXP.test(matchText)) {
|
|
64
|
+
const table = parentNode.getPreviousSibling();
|
|
65
|
+
if (!table || !$isTableNode(table)) return;
|
|
66
|
+
const rows = table.getChildren();
|
|
67
|
+
const lastRow = rows[rows.length - 1];
|
|
68
|
+
if (!lastRow || !$isTableRowNode(lastRow)) return;
|
|
69
|
+
convertToHeaderCells(lastRow.getChildren());
|
|
70
|
+
parentNode.remove();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const matchCells = mapToTableCells(matchText);
|
|
74
|
+
if (null == matchCells) return;
|
|
75
|
+
const rows = [
|
|
76
|
+
matchCells
|
|
77
|
+
];
|
|
78
|
+
let sibling = parentNode.getPreviousSibling();
|
|
79
|
+
let maxCells = matchCells.length;
|
|
80
|
+
let isHeaderRow = false;
|
|
81
|
+
while(sibling){
|
|
82
|
+
if (!$isParagraphNode(sibling)) break;
|
|
83
|
+
if (1 !== sibling.getChildrenSize()) break;
|
|
84
|
+
const firstChild = sibling.getFirstChild();
|
|
85
|
+
if (!$isTextNode(firstChild)) break;
|
|
86
|
+
if (TABLE_ROW_DIVIDER_REG_EXP.test(firstChild.getTextContent())) isHeaderRow = true;
|
|
87
|
+
else {
|
|
88
|
+
const cells = mapToTableCells(firstChild.getTextContent());
|
|
89
|
+
if (null == cells) break;
|
|
90
|
+
if (isHeaderRow) {
|
|
91
|
+
convertToHeaderCells(cells);
|
|
92
|
+
isHeaderRow = false;
|
|
93
|
+
}
|
|
94
|
+
maxCells = Math.max(maxCells, cells.length);
|
|
95
|
+
rows.unshift(cells);
|
|
96
|
+
}
|
|
97
|
+
const previousSibling = sibling.getPreviousSibling();
|
|
98
|
+
sibling.remove();
|
|
99
|
+
sibling = previousSibling;
|
|
100
|
+
}
|
|
101
|
+
const table = $createTableNode();
|
|
102
|
+
for (const cells of rows){
|
|
103
|
+
const tableRow = $createTableRowNode();
|
|
104
|
+
table.append(tableRow);
|
|
105
|
+
tableRow.append(...cells);
|
|
106
|
+
const lenDiff = maxCells - cells.length;
|
|
107
|
+
const isInHeaderRow = cells[0]?.__headerState === TableCellHeaderStates.ROW;
|
|
108
|
+
for(let i = 0; i < lenDiff; i++){
|
|
109
|
+
const newCell = $createTableCell('');
|
|
110
|
+
if (isInHeaderRow) newCell.toggleHeaderStyle(TableCellHeaderStates.ROW);
|
|
111
|
+
tableRow.append(newCell);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const previousSibling = parentNode.getPreviousSibling();
|
|
115
|
+
if ($isTableNode(previousSibling) && getTableColumnsSize(previousSibling) === maxCells) {
|
|
116
|
+
previousSibling.append(...table.getChildren());
|
|
117
|
+
parentNode.remove();
|
|
118
|
+
previousSibling.selectEnd();
|
|
119
|
+
} else {
|
|
120
|
+
parentNode.replace(table);
|
|
121
|
+
table.selectEnd();
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
type: 'element'
|
|
125
|
+
};
|
|
126
|
+
function getTableColumnsSize(table) {
|
|
127
|
+
const row = table.getFirstChild();
|
|
128
|
+
return $isTableRowNode(row) ? row.getChildrenSize() : 0;
|
|
129
|
+
}
|
|
130
|
+
const $createTableCell = (textContent)=>{
|
|
131
|
+
textContent = textContent.replace(/\\r?\\n/g, '\n');
|
|
132
|
+
const cell = $createTableCellNode(TableCellHeaderStates.NO_STATUS);
|
|
133
|
+
$convertFromMarkdownString(textContent, RTE_TRANSFORMERS, cell);
|
|
134
|
+
return cell;
|
|
135
|
+
};
|
|
136
|
+
const mapToTableCells = (textContent)=>{
|
|
137
|
+
const match = textContent.match(TABLE_ROW_REG_EXP);
|
|
138
|
+
if (!match?.[1]) return null;
|
|
139
|
+
return match[1].split('|').map((text)=>$createTableCell(text));
|
|
140
|
+
};
|
|
141
|
+
const convertToHeaderCells = (row)=>{
|
|
142
|
+
row.forEach((cell)=>{
|
|
143
|
+
if (!$isTableCellNode(cell)) return;
|
|
144
|
+
cell.toggleHeaderStyle(TableCellHeaderStates.ROW);
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const RTE_TRANSFORMERS = [
|
|
148
|
+
...TRANSFORMERS,
|
|
149
|
+
UNDERLINE_EXPORTER_AND_TRANSFORMER,
|
|
150
|
+
UNDERLINE_IMPORTER,
|
|
151
|
+
TABLE
|
|
152
|
+
];
|
|
153
|
+
export { RTE_TRANSFORMERS };
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
default: ()=>ToolbarPlugin
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const link_namespaceObject = require("@lexical/link");
|
|
31
|
+
const list_namespaceObject = require("@lexical/list");
|
|
32
|
+
const LexicalComposerContext_namespaceObject = require("@lexical/react/LexicalComposerContext");
|
|
33
|
+
const rich_text_namespaceObject = require("@lexical/rich-text");
|
|
34
|
+
const selection_namespaceObject = require("@lexical/selection");
|
|
35
|
+
const utils_namespaceObject = require("@lexical/utils");
|
|
36
|
+
const icons_material_namespaceObject = require("@mui/icons-material");
|
|
37
|
+
const material_namespaceObject = require("@mui/material");
|
|
38
|
+
const external_lexical_namespaceObject = require("lexical");
|
|
39
|
+
const external_react_namespaceObject = require("react");
|
|
40
|
+
const useSafeLingui_cjs_namespaceObject = require("../../../../i18n/useSafeLingui.cjs");
|
|
41
|
+
const LowPriority = 1;
|
|
42
|
+
function Divider() {
|
|
43
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
44
|
+
className: "divider"
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function getSelectedNode(selection) {
|
|
48
|
+
const anchor = selection.anchor;
|
|
49
|
+
const focus = selection.focus;
|
|
50
|
+
const anchorNode = selection.anchor.getNode();
|
|
51
|
+
const focusNode = selection.focus.getNode();
|
|
52
|
+
if (anchorNode === focusNode) return anchorNode;
|
|
53
|
+
const isBackward = selection.isBackward();
|
|
54
|
+
if (isBackward) return (0, selection_namespaceObject.$isAtNodeEnd)(focus) ? anchorNode : focusNode;
|
|
55
|
+
return (0, selection_namespaceObject.$isAtNodeEnd)(anchor) ? focusNode : anchorNode;
|
|
56
|
+
}
|
|
57
|
+
function ToolbarPlugin({ disabled = false }) {
|
|
58
|
+
const [editor] = (0, LexicalComposerContext_namespaceObject.useLexicalComposerContext)();
|
|
59
|
+
const toolbarRef = (0, external_react_namespaceObject.useRef)(null);
|
|
60
|
+
const { _ } = (0, useSafeLingui_cjs_namespaceObject.useSafeLingui)();
|
|
61
|
+
const [isBold, setIsBold] = (0, external_react_namespaceObject.useState)(false);
|
|
62
|
+
const [isItalic, setIsItalic] = (0, external_react_namespaceObject.useState)(false);
|
|
63
|
+
const [isUnderline, setIsUnderline] = (0, external_react_namespaceObject.useState)(false);
|
|
64
|
+
const [isStrikethrough, setIsStrikethrough] = (0, external_react_namespaceObject.useState)(false);
|
|
65
|
+
const [blockType, setBlockType] = (0, external_react_namespaceObject.useState)('paragraph');
|
|
66
|
+
const [isLink, setIsLink] = (0, external_react_namespaceObject.useState)(false);
|
|
67
|
+
const [isCode, setIsCode] = (0, external_react_namespaceObject.useState)(false);
|
|
68
|
+
const $updateToolbar = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
69
|
+
const selection = (0, external_lexical_namespaceObject.$getSelection)();
|
|
70
|
+
if ((0, external_lexical_namespaceObject.$isRangeSelection)(selection)) {
|
|
71
|
+
const anchorNode = selection.anchor.getNode();
|
|
72
|
+
const element = 'root' === anchorNode.getKey() ? anchorNode : anchorNode.getTopLevelElementOrThrow();
|
|
73
|
+
const elementKey = element.getKey();
|
|
74
|
+
const elementDOM = editor.getElementByKey(elementKey);
|
|
75
|
+
if (null !== elementDOM) if ((0, list_namespaceObject.$isListNode)(element)) {
|
|
76
|
+
const parentList = (0, utils_namespaceObject.$getNearestNodeOfType)(anchorNode, list_namespaceObject.ListNode);
|
|
77
|
+
const type = parentList ? parentList.getTag() : element.getTag();
|
|
78
|
+
setBlockType(type);
|
|
79
|
+
} else {
|
|
80
|
+
const type = (0, rich_text_namespaceObject.$isHeadingNode)(element) ? element.getTag() : element.getType();
|
|
81
|
+
setBlockType(type);
|
|
82
|
+
}
|
|
83
|
+
setIsBold(selection.hasFormat('bold'));
|
|
84
|
+
setIsItalic(selection.hasFormat('italic'));
|
|
85
|
+
setIsUnderline(selection.hasFormat('underline'));
|
|
86
|
+
setIsStrikethrough(selection.hasFormat('strikethrough'));
|
|
87
|
+
setIsCode(selection.hasFormat('code'));
|
|
88
|
+
const node = getSelectedNode(selection);
|
|
89
|
+
const parent = node.getParent();
|
|
90
|
+
(0, link_namespaceObject.$isLinkNode)(parent) || (0, link_namespaceObject.$isLinkNode)(node) ? setIsLink(true) : setIsLink(false);
|
|
91
|
+
}
|
|
92
|
+
}, [
|
|
93
|
+
editor
|
|
94
|
+
]);
|
|
95
|
+
(0, external_react_namespaceObject.useEffect)(()=>(0, utils_namespaceObject.mergeRegister)(editor.registerUpdateListener(({ editorState })=>{
|
|
96
|
+
editorState.read(()=>{
|
|
97
|
+
$updateToolbar();
|
|
98
|
+
});
|
|
99
|
+
}), editor.registerCommand(external_lexical_namespaceObject.SELECTION_CHANGE_COMMAND, ()=>{
|
|
100
|
+
$updateToolbar();
|
|
101
|
+
return false;
|
|
102
|
+
}, LowPriority)), [
|
|
103
|
+
editor,
|
|
104
|
+
$updateToolbar
|
|
105
|
+
]);
|
|
106
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
107
|
+
className: `toolbar${disabled ? ' disabled' : ''}`,
|
|
108
|
+
ref: toolbarRef,
|
|
109
|
+
role: "toolbar",
|
|
110
|
+
"aria-orientation": "horizontal",
|
|
111
|
+
"aria-disabled": disabled,
|
|
112
|
+
children: [
|
|
113
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Tooltip, {
|
|
114
|
+
title: _({
|
|
115
|
+
id: 'rich-text-editor.bold'
|
|
116
|
+
}),
|
|
117
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
118
|
+
type: "button",
|
|
119
|
+
onClick: ()=>{
|
|
120
|
+
editor.dispatchCommand(external_lexical_namespaceObject.FORMAT_TEXT_COMMAND, 'bold');
|
|
121
|
+
},
|
|
122
|
+
disabled: disabled,
|
|
123
|
+
className: 'toolbar-item spaced ' + (isBold ? 'active' : ''),
|
|
124
|
+
"aria-pressed": isBold,
|
|
125
|
+
"aria-label": _({
|
|
126
|
+
id: 'rich-text-editor.format-bold'
|
|
127
|
+
}),
|
|
128
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_material_namespaceObject.FormatBold, {
|
|
129
|
+
sx: {
|
|
130
|
+
fontSize: '24px'
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
}),
|
|
135
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Tooltip, {
|
|
136
|
+
title: _({
|
|
137
|
+
id: 'rich-text-editor.italic'
|
|
138
|
+
}),
|
|
139
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
140
|
+
type: "button",
|
|
141
|
+
onClick: ()=>{
|
|
142
|
+
editor.dispatchCommand(external_lexical_namespaceObject.FORMAT_TEXT_COMMAND, 'italic');
|
|
143
|
+
},
|
|
144
|
+
className: 'toolbar-item spaced ' + (isItalic ? 'active' : ''),
|
|
145
|
+
"aria-pressed": isItalic,
|
|
146
|
+
disabled: disabled,
|
|
147
|
+
"aria-label": _({
|
|
148
|
+
id: 'rich-text-editor.format-italic'
|
|
149
|
+
}),
|
|
150
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_material_namespaceObject.FormatItalic, {
|
|
151
|
+
sx: {
|
|
152
|
+
fontSize: '24px'
|
|
153
|
+
}
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
}),
|
|
157
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Tooltip, {
|
|
158
|
+
title: _({
|
|
159
|
+
id: 'rich-text-editor.underline'
|
|
160
|
+
}),
|
|
161
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
162
|
+
type: "button",
|
|
163
|
+
onClick: ()=>{
|
|
164
|
+
editor.dispatchCommand(external_lexical_namespaceObject.FORMAT_TEXT_COMMAND, 'underline');
|
|
165
|
+
},
|
|
166
|
+
className: 'toolbar-item spaced ' + (isUnderline ? 'active' : ''),
|
|
167
|
+
"aria-pressed": isUnderline,
|
|
168
|
+
disabled: disabled,
|
|
169
|
+
"aria-label": _({
|
|
170
|
+
id: 'rich-text-editor.format-underline'
|
|
171
|
+
}),
|
|
172
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_material_namespaceObject.FormatUnderlined, {
|
|
173
|
+
sx: {
|
|
174
|
+
fontSize: '24px'
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
})
|
|
178
|
+
}),
|
|
179
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Tooltip, {
|
|
180
|
+
title: _({
|
|
181
|
+
id: 'rich-text-editor.strikethrough'
|
|
182
|
+
}),
|
|
183
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
184
|
+
type: "button",
|
|
185
|
+
onClick: ()=>{
|
|
186
|
+
editor.dispatchCommand(external_lexical_namespaceObject.FORMAT_TEXT_COMMAND, 'strikethrough');
|
|
187
|
+
},
|
|
188
|
+
className: 'toolbar-item spaced ' + (isStrikethrough ? 'active' : ''),
|
|
189
|
+
"aria-pressed": isStrikethrough,
|
|
190
|
+
disabled: disabled,
|
|
191
|
+
"aria-label": _({
|
|
192
|
+
id: 'rich-text-editor.format-strikethrough'
|
|
193
|
+
}),
|
|
194
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_material_namespaceObject.FormatStrikethrough, {
|
|
195
|
+
sx: {
|
|
196
|
+
fontSize: '24px'
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
}),
|
|
201
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Divider, {}),
|
|
202
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Tooltip, {
|
|
203
|
+
title: _({
|
|
204
|
+
id: 'rich-text-editor.unordered-list'
|
|
205
|
+
}),
|
|
206
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
207
|
+
type: "button",
|
|
208
|
+
onClick: ()=>{
|
|
209
|
+
if ('ul' !== blockType) editor.dispatchCommand(list_namespaceObject.INSERT_UNORDERED_LIST_COMMAND, void 0);
|
|
210
|
+
else editor.dispatchCommand(list_namespaceObject.REMOVE_LIST_COMMAND, void 0);
|
|
211
|
+
},
|
|
212
|
+
className: 'toolbar-item spaced ' + ('ul' === blockType ? 'active' : ''),
|
|
213
|
+
disabled: disabled,
|
|
214
|
+
"aria-pressed": 'ul' === blockType,
|
|
215
|
+
"aria-label": _({
|
|
216
|
+
id: 'rich-text-editor.format-unordered-list'
|
|
217
|
+
}),
|
|
218
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_material_namespaceObject.FormatListBulleted, {
|
|
219
|
+
sx: {
|
|
220
|
+
fontSize: '24px'
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
})
|
|
224
|
+
}),
|
|
225
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Tooltip, {
|
|
226
|
+
title: _({
|
|
227
|
+
id: 'rich-text-editor.ordered-list'
|
|
228
|
+
}),
|
|
229
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
230
|
+
type: "button",
|
|
231
|
+
onClick: ()=>{
|
|
232
|
+
if ('ol' !== blockType) editor.dispatchCommand(list_namespaceObject.INSERT_ORDERED_LIST_COMMAND, void 0);
|
|
233
|
+
else editor.dispatchCommand(list_namespaceObject.REMOVE_LIST_COMMAND, void 0);
|
|
234
|
+
},
|
|
235
|
+
className: 'toolbar-item spaced ' + ('ol' === blockType ? 'active' : ''),
|
|
236
|
+
disabled: disabled,
|
|
237
|
+
"aria-pressed": 'ol' === blockType,
|
|
238
|
+
"aria-label": _({
|
|
239
|
+
id: 'rich-text-editor.format-ordered-list'
|
|
240
|
+
}),
|
|
241
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_material_namespaceObject.FormatListNumbered, {
|
|
242
|
+
sx: {
|
|
243
|
+
fontSize: '24px'
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
})
|
|
247
|
+
}),
|
|
248
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Divider, {}),
|
|
249
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Tooltip, {
|
|
250
|
+
title: _({
|
|
251
|
+
id: 'rich-text-editor.link'
|
|
252
|
+
}),
|
|
253
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
254
|
+
type: "button",
|
|
255
|
+
onClick: ()=>{
|
|
256
|
+
if (isLink) editor.dispatchCommand(link_namespaceObject.TOGGLE_LINK_COMMAND, null);
|
|
257
|
+
else editor.update(()=>{
|
|
258
|
+
const selection = (0, external_lexical_namespaceObject.$getSelection)();
|
|
259
|
+
if ((0, external_lexical_namespaceObject.$isRangeSelection)(selection)) selection.insertText(`[${selection.getTextContent() || 'text'}](link)`);
|
|
260
|
+
});
|
|
261
|
+
},
|
|
262
|
+
className: 'toolbar-item spaced ' + (isLink ? 'active' : ''),
|
|
263
|
+
disabled: disabled,
|
|
264
|
+
"aria-pressed": isLink,
|
|
265
|
+
"aria-label": _({
|
|
266
|
+
id: 'rich-text-editor.insert-link'
|
|
267
|
+
}),
|
|
268
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_material_namespaceObject.Link, {
|
|
269
|
+
sx: {
|
|
270
|
+
fontSize: '24px'
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
})
|
|
274
|
+
}),
|
|
275
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(material_namespaceObject.Tooltip, {
|
|
276
|
+
title: _({
|
|
277
|
+
id: 'rich-text-editor.code'
|
|
278
|
+
}),
|
|
279
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
280
|
+
type: "button",
|
|
281
|
+
onClick: ()=>{
|
|
282
|
+
editor.dispatchCommand(external_lexical_namespaceObject.FORMAT_TEXT_COMMAND, 'code');
|
|
283
|
+
},
|
|
284
|
+
className: 'toolbar-item spaced ' + (isCode ? 'active' : ''),
|
|
285
|
+
"aria-pressed": isCode,
|
|
286
|
+
disabled: disabled,
|
|
287
|
+
"aria-label": _({
|
|
288
|
+
id: 'rich-text-editor.format-code'
|
|
289
|
+
}),
|
|
290
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_material_namespaceObject.Code, {
|
|
291
|
+
sx: {
|
|
292
|
+
fontSize: '24px'
|
|
293
|
+
}
|
|
294
|
+
})
|
|
295
|
+
})
|
|
296
|
+
})
|
|
297
|
+
]
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
exports["default"] = __webpack_exports__["default"];
|
|
301
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
302
|
+
"default"
|
|
303
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
304
|
+
Object.defineProperty(exports, '__esModule', {
|
|
305
|
+
value: true
|
|
306
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarPlugin.d.ts","sourceRoot":"","sources":["../../../../../src/material/components/ap-rich-text-editor/plugins/ToolbarPlugin.tsx"],"names":[],"mappings":"AAwDA,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,QAAgB,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,2CA0NjF"}
|