@sveltia/ui 0.89.2 → 0.90.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/components/checkbox/checkbox.svelte +5 -8
- package/dist/components/dialog/dialog.svelte +149 -9
- package/dist/components/emoji/emoji-suggestions.svelte +7 -7
- package/dist/components/grid/grid-col-header.svelte +4 -0
- package/dist/components/grid/grid-head.svelte +1 -1
- package/dist/components/grid/grid-head.svelte.d.ts +1 -1
- package/dist/components/radio/radio.svelte +9 -9
- package/dist/components/resizable-pane/resizable-pane-group.svelte +5 -20
- package/dist/components/resizable-pane/sizing.d.ts +6 -0
- package/dist/components/resizable-pane/sizing.js +31 -0
- package/dist/components/text-editor/code-editor.svelte +22 -39
- package/dist/components/text-editor/constants.js +3 -3
- package/dist/components/text-editor/conversion/editor-components.d.ts +5 -0
- package/dist/components/text-editor/conversion/editor-components.js +228 -0
- package/dist/components/text-editor/{html.d.ts → conversion/html.d.ts} +1 -1
- package/dist/components/text-editor/{html.js → conversion/html.js} +158 -20
- package/dist/components/text-editor/conversion/import.d.ts +12 -0
- package/dist/components/text-editor/conversion/import.js +327 -0
- package/dist/components/text-editor/conversion/paste.d.ts +4 -0
- package/dist/components/text-editor/conversion/paste.js +166 -0
- package/dist/components/text-editor/{transformers → conversion/transformers}/raw-syntax.js +4 -4
- package/dist/components/text-editor/conversion/transformers/table.js +342 -0
- package/dist/components/text-editor/conversion/update.d.ts +6 -0
- package/dist/components/text-editor/conversion/update.js +125 -0
- package/dist/components/text-editor/core.d.ts +50 -26
- package/dist/components/text-editor/core.js +133 -1694
- package/dist/components/text-editor/editing/caret.d.ts +4 -0
- package/dist/components/text-editor/editing/caret.js +248 -0
- package/dist/components/text-editor/editing/commands.d.ts +5 -0
- package/dist/components/text-editor/editing/commands.js +205 -0
- package/dist/components/text-editor/editing/link.d.ts +19 -0
- package/dist/components/text-editor/editing/link.js +222 -0
- package/dist/components/text-editor/{raw-markdown.d.ts → editing/raw-markdown.d.ts} +3 -3
- package/dist/components/text-editor/{raw-markdown.js → editing/raw-markdown.js} +2 -2
- package/dist/components/text-editor/editing/selection.d.ts +5 -0
- package/dist/components/text-editor/editing/selection.js +122 -0
- package/dist/components/text-editor/editing/single-line.d.ts +8 -0
- package/dist/components/text-editor/editing/single-line.js +190 -0
- package/dist/components/text-editor/{table.js → editing/table.js} +1 -1
- package/dist/components/text-editor/lexical-root.svelte +61 -10
- package/dist/components/text-editor/shiki/preload.d.ts +1 -0
- package/dist/components/text-editor/shiki/preload.js +30 -0
- package/dist/components/text-editor/shiki/version.d.ts +1 -1
- package/dist/components/text-editor/shiki/version.js +1 -1
- package/dist/components/text-editor/store.svelte.d.ts +5 -0
- package/dist/components/text-editor/store.svelte.js +55 -1
- package/dist/components/text-editor/text-editor.svelte +29 -41
- package/dist/components/text-editor/toolbar/align-menu-button.svelte +1 -1
- package/dist/components/text-editor/toolbar/code-language-switcher.svelte +2 -1
- package/dist/components/text-editor/toolbar/format-text-button.svelte +6 -2
- package/dist/components/text-editor/toolbar/insert-component.js +1 -1
- package/dist/components/text-editor/toolbar/insert-horizontal-rule-button.svelte +4 -4
- package/dist/components/text-editor/toolbar/insert-link-button.svelte +3 -2
- package/dist/components/text-editor/toolbar/insert-table-button.svelte +7 -3
- package/dist/components/text-editor/toolbar/table-action-menu.svelte +3 -3
- package/dist/components/text-editor/toolbar/text-editor-toolbar.svelte +1 -1
- package/dist/components/text-editor/toolbar/toggle-block-menu-item.svelte +2 -2
- package/dist/components/text-editor/utils.d.ts +1 -0
- package/dist/components/text-editor/utils.js +17 -0
- package/dist/components/text-editor/{emoji-autocomplete.svelte → widgets/emoji-autocomplete.svelte} +3 -3
- package/dist/components/text-editor/{floating-link-editor.svelte → widgets/floating-link-editor.svelte} +36 -79
- package/dist/components/text-editor/{table-cell-menu-button.svelte → widgets/table-cell-menu-button.svelte} +15 -5
- package/dist/components/text-field/date-time-input.svelte +8 -8
- package/dist/components/text-field/text-area.svelte +10 -10
- package/dist/components/text-field/text-input.svelte +7 -7
- package/dist/components/util/modal.svelte +41 -12
- package/dist/components/util/popup.svelte +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/es-ES.yaml +174 -0
- package/dist/services/label.d.ts +8 -0
- package/dist/services/label.js +15 -0
- package/dist/services/popup-position.d.ts +9 -0
- package/dist/services/popup-position.js +52 -55
- package/dist/styles/mixins.scss +69 -0
- package/dist/typedefs.d.ts +28 -1
- package/dist/typedefs.js +16 -1
- package/package.json +13 -11
- package/dist/components/text-editor/transformers/table.js +0 -296
- /package/dist/components/text-editor/{markdown.d.ts → conversion/markdown.d.ts} +0 -0
- /package/dist/components/text-editor/{markdown.js → conversion/markdown.js} +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/block-escape.d.ts +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/block-escape.js +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/code.d.ts +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/code.js +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/formatted-code.d.ts +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/formatted-code.js +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/hr.d.ts +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/hr.js +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/inline-code.d.ts +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/inline-code.js +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/link.d.ts +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/link.js +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/raw-syntax.d.ts +0 -0
- /package/dist/components/text-editor/{transformers → conversion/transformers}/table.d.ts +0 -0
- /package/dist/components/text-editor/{alignment.d.ts → editing/alignment.d.ts} +0 -0
- /package/dist/components/text-editor/{alignment.js → editing/alignment.js} +0 -0
- /package/dist/components/text-editor/{block.d.ts → editing/block.d.ts} +0 -0
- /package/dist/components/text-editor/{block.js → editing/block.js} +0 -0
- /package/dist/components/text-editor/{table.d.ts → editing/table.d.ts} +0 -0
- /package/dist/components/text-editor/{emoji-autocomplete.svelte.d.ts → widgets/emoji-autocomplete.svelte.d.ts} +0 -0
- /package/dist/components/text-editor/{floating-link-editor.svelte.d.ts → widgets/floating-link-editor.svelte.d.ts} +0 -0
- /package/dist/components/text-editor/{table-cell-menu-button.svelte.d.ts → widgets/table-cell-menu-button.svelte.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.90.0",
|
|
4
4
|
"description": "A collection of Svelte components and utilities for building user interfaces.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"@fontsource-variable/source-sans-3": "5.3.1",
|
|
71
71
|
"@fontsource/noto-mono": "5.3.0",
|
|
72
72
|
"@rollup/plugin-yaml": "^5.0.1",
|
|
73
|
-
"@sveltejs/adapter-auto": "^8.0.
|
|
74
|
-
"@sveltejs/kit": "^3.
|
|
73
|
+
"@sveltejs/adapter-auto": "^8.0.1",
|
|
74
|
+
"@sveltejs/kit": "^3.2.0",
|
|
75
75
|
"@sveltejs/package": "^3.0.2",
|
|
76
76
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
77
77
|
"@vitest/browser-playwright": "^5.1.0",
|
|
@@ -86,23 +86,24 @@
|
|
|
86
86
|
"eslint-plugin-svelte": "^3.24.1",
|
|
87
87
|
"globals": "^17.14.0",
|
|
88
88
|
"happy-dom": "^21.0.4",
|
|
89
|
-
"
|
|
89
|
+
"jscpd": "^5.4.3",
|
|
90
|
+
"oxlint": "^1.93.0",
|
|
90
91
|
"playwright": "^1.65.0",
|
|
91
92
|
"postcss": "^8.5.32",
|
|
92
93
|
"postcss-html": "^2.0.0",
|
|
93
|
-
"prettier": "^3.
|
|
94
|
+
"prettier": "^3.10.1",
|
|
94
95
|
"prettier-plugin-svelte": "^4.1.1",
|
|
95
|
-
"rolldown": "^1.3.
|
|
96
|
-
"sass": "^1.108.
|
|
96
|
+
"rolldown": "^1.3.2",
|
|
97
|
+
"sass": "^1.108.2",
|
|
97
98
|
"shiki": "^4.6.0",
|
|
98
99
|
"stylelint": "^18.0.0",
|
|
99
|
-
"stylelint-config-recommended-scss": "^
|
|
100
|
-
"stylelint-scss": "^7.
|
|
100
|
+
"stylelint-config-recommended-scss": "^18.0.0",
|
|
101
|
+
"stylelint-scss": "^7.5.0",
|
|
101
102
|
"svelte": "^5.57.3",
|
|
102
103
|
"svelte-check": "^4.7.8",
|
|
103
104
|
"svelte-preprocess": "^6.0.5",
|
|
104
105
|
"tslib": "^2.9.1",
|
|
105
|
-
"vite": "^8.3.
|
|
106
|
+
"vite": "^8.3.8",
|
|
106
107
|
"vitest": "^5.1.0",
|
|
107
108
|
"vitest-browser-svelte": "^3.1.0"
|
|
108
109
|
},
|
|
@@ -119,6 +120,7 @@
|
|
|
119
120
|
"check": "pnpm run --no-bail '/^check:.*/'",
|
|
120
121
|
"check:audit": "pnpm audit --ignore-registry-errors",
|
|
121
122
|
"check:cspell": "cspell --no-progress",
|
|
123
|
+
"check:duplicates": "jscpd --silent",
|
|
122
124
|
"check:eslint": "eslint .",
|
|
123
125
|
"check:oxlint": "oxlint .",
|
|
124
126
|
"check:prettier": "prettier --check .",
|
|
@@ -131,7 +133,7 @@
|
|
|
131
133
|
"generate:shiki": "node scripts/generate-shiki-metadata.js",
|
|
132
134
|
"preview": "vite preview",
|
|
133
135
|
"test": "vitest run",
|
|
134
|
-
"test:coverage": "vitest run --coverage",
|
|
136
|
+
"test:coverage": "vitest run --coverage --browser.name=chromium",
|
|
135
137
|
"test:watch": "vitest"
|
|
136
138
|
}
|
|
137
139
|
}
|
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
// Adopted from https://github.com/facebook/lexical/blob/main/packages/lexical-playground/src/plugins/MarkdownTransformers/index.ts
|
|
2
|
-
|
|
3
|
-
/* eslint-disable jsdoc/require-jsdoc */
|
|
4
|
-
/* eslint-disable jsdoc/require-returns-description */
|
|
5
|
-
/* eslint-disable jsdoc/require-param-description */
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
$convertFromMarkdownString as convertFromMarkdownString,
|
|
9
|
-
$convertToMarkdownString as convertToMarkdownString,
|
|
10
|
-
LINK as LEXICAL_LINK,
|
|
11
|
-
TRANSFORMERS,
|
|
12
|
-
} from '@lexical/markdown';
|
|
13
|
-
import {
|
|
14
|
-
$createTableCellNode as createTableCellNode,
|
|
15
|
-
$createTableNode as createTableNode,
|
|
16
|
-
$createTableRowNode as createTableRowNode,
|
|
17
|
-
$isTableCellNode as isTableCellNode,
|
|
18
|
-
$isTableNode as isTableNode,
|
|
19
|
-
$isTableRowNode as isTableRowNode,
|
|
20
|
-
TableCellHeaderStates,
|
|
21
|
-
TableCellNode,
|
|
22
|
-
TableNode,
|
|
23
|
-
TableRowNode,
|
|
24
|
-
} from '@lexical/table';
|
|
25
|
-
import { $isParagraphNode as isParagraphNode, $isTextNode as isTextNode } from 'lexical';
|
|
26
|
-
|
|
27
|
-
import { BLOCK_SYNTAX_ESCAPE } from './block-escape.js';
|
|
28
|
-
import { LEADING_INLINE_CODE } from './inline-code.js';
|
|
29
|
-
import { LINK } from './link.js';
|
|
30
|
-
import { RAW_HTML, RAW_SYNTAX } from './raw-syntax.js';
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @import { ElementTransformer, TextMatchTransformer, Transformer } from '@lexical/markdown';
|
|
34
|
-
* @import { ElementFormatType } from 'lexical';
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
const TABLE_ROW_REG_EXP = /^(?:\|)(.+)(?:\|)\s?$/;
|
|
38
|
-
/**
|
|
39
|
-
* Regular expression to match a delimiter row, like `| --- | :-: |`. Each cell needs a hyphen, so a
|
|
40
|
-
* row of empty cells, like `| | |`, is an empty header row, not a delimiter row.
|
|
41
|
-
* @see https://github.github.com/gfm/#delimiter-row
|
|
42
|
-
*/
|
|
43
|
-
const TABLE_ROW_DIVIDER_REG_EXP = /^(?:\|[ \t]*:?-+:?[ \t]*)+\|\s?$/;
|
|
44
|
-
/**
|
|
45
|
-
* Delimiter row cell for each column alignment, which is kept as the format of the column’s cells.
|
|
46
|
-
* @type {Record<string, string>}
|
|
47
|
-
*/
|
|
48
|
-
const ALIGNMENT_DELIMITERS = { left: ':---', center: ':---:', right: '---:' };
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Get the alignment of a column from its delimiter row cell, like `:-:`.
|
|
52
|
-
* @param {string} delimiter Delimiter row cell.
|
|
53
|
-
* @returns {ElementFormatType} Alignment, or an empty string for the default.
|
|
54
|
-
*/
|
|
55
|
-
const getColumnAlignment = (delimiter) => {
|
|
56
|
-
const text = delimiter.trim();
|
|
57
|
-
const left = text.startsWith(':');
|
|
58
|
-
const right = text.endsWith(':');
|
|
59
|
-
|
|
60
|
-
return left && right ? 'center' : left ? 'left' : right ? 'right' : '';
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Returns the number of columns in the table.
|
|
65
|
-
* @internal
|
|
66
|
-
* @param {TableNode} table
|
|
67
|
-
* @returns {number}
|
|
68
|
-
*/
|
|
69
|
-
export const getTableColumnsSize = (table) => {
|
|
70
|
-
const row = table.getFirstChild();
|
|
71
|
-
|
|
72
|
-
return isTableRowNode(row) ? row.getChildrenSize() : 0;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Creates a table cell with the given text content.
|
|
77
|
-
* @param {string} textContent
|
|
78
|
-
* @param {Transformer[]} transformers Transformers to import the cell content with.
|
|
79
|
-
* @returns {TableCellNode}
|
|
80
|
-
*/
|
|
81
|
-
const createTableCell = (textContent, transformers) => {
|
|
82
|
-
// An escaped pipe is part of the cell, even within inline code, like GitHub Flavored Markdown.
|
|
83
|
-
// The spaces around the content only separate it from the pipes
|
|
84
|
-
textContent = textContent.trim().replace(/\\n/g, '\n').replace(/\\\|/g, '|');
|
|
85
|
-
|
|
86
|
-
const cell = createTableCellNode(TableCellHeaderStates.NO_STATUS);
|
|
87
|
-
|
|
88
|
-
convertFromMarkdownString(textContent, transformers, cell);
|
|
89
|
-
|
|
90
|
-
return cell;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Maps the given text content to an array of table cells.
|
|
95
|
-
* @internal
|
|
96
|
-
* @param {string} textContent
|
|
97
|
-
* @param {Transformer[]} transformers Transformers to import the cell content with.
|
|
98
|
-
* @returns {TableCellNode[] | null}
|
|
99
|
-
*/
|
|
100
|
-
export const mapToTableCells = (textContent, transformers) => {
|
|
101
|
-
const [, match] = textContent.match(TABLE_ROW_REG_EXP) ?? [];
|
|
102
|
-
|
|
103
|
-
if (!match) {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Split the row at the pipes that are not escaped, which are preceded by an even number of
|
|
108
|
-
// backslashes
|
|
109
|
-
return match.split(/(?<=(?<!\\)(?:\\\\)*)\|/).map((text) => createTableCell(text, transformers));
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Create a table transformer. A cell can only have inline content, so it’s converted with the
|
|
114
|
-
* standard Markdown transformers and the given text match transformers, like those of the inline
|
|
115
|
-
* editor components, which come first to take priority, as they do for the rest of the document.
|
|
116
|
-
* @param {TextMatchTransformer[]} [cellTransformers] Additional transformers for the cell content.
|
|
117
|
-
* @returns {ElementTransformer}
|
|
118
|
-
*/
|
|
119
|
-
export const createTableTransformer = (cellTransformers = []) => {
|
|
120
|
-
/** @type {Transformer[]} */
|
|
121
|
-
const transformers = [
|
|
122
|
-
...cellTransformers,
|
|
123
|
-
...TRANSFORMERS.map((transformer) => (transformer === LEXICAL_LINK ? LINK : transformer)),
|
|
124
|
-
LEADING_INLINE_CODE,
|
|
125
|
-
RAW_HTML,
|
|
126
|
-
RAW_SYNTAX,
|
|
127
|
-
];
|
|
128
|
-
|
|
129
|
-
/** @type {Transformer[]} */
|
|
130
|
-
const exportTransformers = [...transformers, BLOCK_SYNTAX_ESCAPE];
|
|
131
|
-
|
|
132
|
-
return {
|
|
133
|
-
dependencies: [TableNode, TableRowNode, TableCellNode],
|
|
134
|
-
export: (node) => {
|
|
135
|
-
if (!isTableNode(node)) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/** @type {string[]} */
|
|
140
|
-
const output = [];
|
|
141
|
-
|
|
142
|
-
node.getChildren().forEach((row) => {
|
|
143
|
-
/** @type {string[]} */
|
|
144
|
-
const rowOutput = [];
|
|
145
|
-
/** @type {TableCellNode[]} */
|
|
146
|
-
const cells = [];
|
|
147
|
-
|
|
148
|
-
if (!isTableRowNode(row)) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
let isHeaderRow = false;
|
|
153
|
-
|
|
154
|
-
row.getChildren().forEach((cell) => {
|
|
155
|
-
// It’s TableCellNode so it’s just to make flow happy
|
|
156
|
-
if (isTableCellNode(cell)) {
|
|
157
|
-
rowOutput.push(
|
|
158
|
-
convertToMarkdownString(exportTransformers, cell)
|
|
159
|
-
// Escape a pipe, which would otherwise end the cell, even within inline code
|
|
160
|
-
.replace(/\|/g, '\\|')
|
|
161
|
-
.replace(/\n/g, '\\n')
|
|
162
|
-
.trim(),
|
|
163
|
-
);
|
|
164
|
-
cells.push(cell);
|
|
165
|
-
|
|
166
|
-
if (cell.__headerState === TableCellHeaderStates.ROW) {
|
|
167
|
-
isHeaderRow = true;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
output.push(`| ${rowOutput.join(' | ')} |`);
|
|
173
|
-
|
|
174
|
-
if (isHeaderRow) {
|
|
175
|
-
output.push(
|
|
176
|
-
`| ${cells.map((cell) => ALIGNMENT_DELIMITERS[cell.getFormatType()] ?? '---').join(' | ')} |`,
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
return output.join('\n');
|
|
182
|
-
},
|
|
183
|
-
regExp: TABLE_ROW_REG_EXP,
|
|
184
|
-
replace: (parentNode, _children, [textContent]) => {
|
|
185
|
-
// Header row
|
|
186
|
-
if (TABLE_ROW_DIVIDER_REG_EXP.test(textContent)) {
|
|
187
|
-
const table = parentNode.getPreviousSibling();
|
|
188
|
-
|
|
189
|
-
if (!table || !isTableNode(table)) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const rows = table.getChildren();
|
|
194
|
-
const lastRow = rows[rows.length - 1];
|
|
195
|
-
|
|
196
|
-
if (!lastRow || !isTableRowNode(lastRow)) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const alignments = textContent.trim().slice(1, -1).split('|').map(getColumnAlignment);
|
|
201
|
-
|
|
202
|
-
// Add header state to row cells, and the column alignment, which the rows that follow take
|
|
203
|
-
// from the header row
|
|
204
|
-
lastRow.getChildren().forEach((cell, index) => {
|
|
205
|
-
if (!isTableCellNode(cell)) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
cell.setHeaderStyles(TableCellHeaderStates.ROW, TableCellHeaderStates.ROW);
|
|
210
|
-
cell.setFormat(alignments[index] ?? '');
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
// Remove line
|
|
214
|
-
parentNode.remove();
|
|
215
|
-
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
const matchCells = mapToTableCells(textContent, transformers);
|
|
220
|
-
|
|
221
|
-
if (!matchCells) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
const rows = [matchCells];
|
|
226
|
-
let sibling = parentNode.getPreviousSibling();
|
|
227
|
-
let maxCells = matchCells.length;
|
|
228
|
-
|
|
229
|
-
while (sibling) {
|
|
230
|
-
if (!isParagraphNode(sibling)) {
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (sibling.getChildrenSize() !== 1) {
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const firstChild = sibling.getFirstChild();
|
|
239
|
-
|
|
240
|
-
if (!isTextNode(firstChild)) {
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
const cells = mapToTableCells(firstChild.getTextContent(), transformers);
|
|
245
|
-
|
|
246
|
-
if (!cells) {
|
|
247
|
-
break;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
maxCells = Math.max(maxCells, cells.length);
|
|
251
|
-
rows.unshift(cells);
|
|
252
|
-
|
|
253
|
-
const previousSibling = sibling.getPreviousSibling();
|
|
254
|
-
|
|
255
|
-
sibling.remove();
|
|
256
|
-
sibling = previousSibling;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const table = createTableNode();
|
|
260
|
-
|
|
261
|
-
rows.forEach((cells) => {
|
|
262
|
-
const tableRow = createTableRowNode();
|
|
263
|
-
|
|
264
|
-
table.append(tableRow);
|
|
265
|
-
|
|
266
|
-
for (let i = 0; i < maxCells; i += 1) {
|
|
267
|
-
tableRow.append(i < cells.length ? cells[i] : createTableCell('', transformers));
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
const previousSibling = parentNode.getPreviousSibling();
|
|
272
|
-
|
|
273
|
-
if (isTableNode(previousSibling) && getTableColumnsSize(previousSibling) === maxCells) {
|
|
274
|
-
const headerCells = /** @type {TableRowNode} */ (
|
|
275
|
-
previousSibling.getFirstChild()
|
|
276
|
-
).getChildren();
|
|
277
|
-
|
|
278
|
-
table.getChildren().forEach((row) => {
|
|
279
|
-
/** @type {TableRowNode} */ (row).getChildren().forEach((cell, index) => {
|
|
280
|
-
/** @type {TableCellNode} */ (cell).setFormat(
|
|
281
|
-
/** @type {TableCellNode} */ (headerCells[index]).getFormatType(),
|
|
282
|
-
);
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
previousSibling.append(...table.getChildren());
|
|
287
|
-
parentNode.remove();
|
|
288
|
-
} else {
|
|
289
|
-
parentNode.replace(table);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
table.selectEnd();
|
|
293
|
-
},
|
|
294
|
-
type: 'element',
|
|
295
|
-
};
|
|
296
|
-
};
|
|
File without changes
|
|
File without changes
|
/package/dist/components/text-editor/{transformers → conversion/transformers}/block-escape.d.ts
RENAMED
|
File without changes
|
/package/dist/components/text-editor/{transformers → conversion/transformers}/block-escape.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/components/text-editor/{transformers → conversion/transformers}/formatted-code.d.ts
RENAMED
|
File without changes
|
/package/dist/components/text-editor/{transformers → conversion/transformers}/formatted-code.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/components/text-editor/{transformers → conversion/transformers}/inline-code.d.ts
RENAMED
|
File without changes
|
/package/dist/components/text-editor/{transformers → conversion/transformers}/inline-code.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/components/text-editor/{transformers → conversion/transformers}/raw-syntax.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|