@ones-editor/editor 2.1.7-beta.31 → 2.1.7-beta.33
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/index.js
CHANGED
|
@@ -73889,6 +73889,22 @@ ${content}
|
|
|
73889
73889
|
}
|
|
73890
73890
|
return colsWidth;
|
|
73891
73891
|
}
|
|
73892
|
+
function hasRowHeader(table) {
|
|
73893
|
+
const rows = table.rows;
|
|
73894
|
+
const firstRow = rows[0];
|
|
73895
|
+
if (!firstRow) {
|
|
73896
|
+
return false;
|
|
73897
|
+
}
|
|
73898
|
+
const cells = firstRow.cells;
|
|
73899
|
+
return Array.from(cells).every((cell) => cell.tagName === "TH");
|
|
73900
|
+
}
|
|
73901
|
+
function hasColHeader(table) {
|
|
73902
|
+
const rows = table.rows;
|
|
73903
|
+
return Array.from(rows).every((row) => {
|
|
73904
|
+
const cells = row.cells;
|
|
73905
|
+
return cells.length > 0 && cells[0].tagName === "TH";
|
|
73906
|
+
});
|
|
73907
|
+
}
|
|
73892
73908
|
function tableElementToBlock(table, options) {
|
|
73893
73909
|
var _a;
|
|
73894
73910
|
const grid = createGrid(table);
|
|
@@ -73939,6 +73955,8 @@ ${content}
|
|
|
73939
73955
|
if (children.length === 0) {
|
|
73940
73956
|
return [];
|
|
73941
73957
|
}
|
|
73958
|
+
const hasRowTitle = hasRowHeader(table);
|
|
73959
|
+
const hasColTitle = hasColHeader(table);
|
|
73942
73960
|
return [{
|
|
73943
73961
|
cols: grid.colCount,
|
|
73944
73962
|
rows: grid.rowCount,
|
|
@@ -73946,7 +73964,9 @@ ${content}
|
|
|
73946
73964
|
type: "table",
|
|
73947
73965
|
children,
|
|
73948
73966
|
...spanData,
|
|
73949
|
-
colsWidth
|
|
73967
|
+
colsWidth,
|
|
73968
|
+
hasRowTitle,
|
|
73969
|
+
hasColTitle
|
|
73950
73970
|
}];
|
|
73951
73971
|
}
|
|
73952
73972
|
function convertAllTables(node, options) {
|
|
@@ -74023,6 +74043,39 @@ ${content}
|
|
|
74023
74043
|
}
|
|
74024
74044
|
});
|
|
74025
74045
|
}
|
|
74046
|
+
function figcaptionToTextBlock(ts) {
|
|
74047
|
+
ts.addRule("figcaption", {
|
|
74048
|
+
filter: (node) => {
|
|
74049
|
+
return node.nodeName === "FIGCAPTION";
|
|
74050
|
+
},
|
|
74051
|
+
replacement: (content, node, options) => {
|
|
74052
|
+
var _a;
|
|
74053
|
+
const text2 = (_a = node.textContent) != null ? _a : "";
|
|
74054
|
+
const richText2 = createRichText(text2, {
|
|
74055
|
+
"style-color-6": true,
|
|
74056
|
+
"style-italic": true
|
|
74057
|
+
});
|
|
74058
|
+
const doc2 = {
|
|
74059
|
+
blocks: {
|
|
74060
|
+
root: [{
|
|
74061
|
+
id: genId(),
|
|
74062
|
+
type: "text",
|
|
74063
|
+
text: richText2
|
|
74064
|
+
}]
|
|
74065
|
+
},
|
|
74066
|
+
meta: {},
|
|
74067
|
+
comments: {}
|
|
74068
|
+
};
|
|
74069
|
+
const docStr = toBase64URL(JSON.stringify(doc2));
|
|
74070
|
+
return `
|
|
74071
|
+
|
|
74072
|
+
\`\`\`
|
|
74073
|
+
${docStr}
|
|
74074
|
+
\`\`\`
|
|
74075
|
+
`;
|
|
74076
|
+
}
|
|
74077
|
+
});
|
|
74078
|
+
}
|
|
74026
74079
|
const logger$K = getLogger("html-to-doc");
|
|
74027
74080
|
const turndownService = new TurndownService();
|
|
74028
74081
|
turndownService.use(codeListToCode);
|
|
@@ -74035,6 +74088,7 @@ ${content}
|
|
|
74035
74088
|
turndownService.use(wechatMessageTimeToBlockQuote);
|
|
74036
74089
|
turndownService.use(turndownPluginGfm.gfm);
|
|
74037
74090
|
turndownService.use(underline);
|
|
74091
|
+
turndownService.use(figcaptionToTextBlock);
|
|
74038
74092
|
function htmlToBlocks$1(html, options) {
|
|
74039
74093
|
const subDoc = processedHtmlToDocByMarkdown(html, options);
|
|
74040
74094
|
if (!subDoc) {
|
|
@@ -89205,7 +89259,7 @@ ${data2.flowchartText}
|
|
|
89205
89259
|
}
|
|
89206
89260
|
}
|
|
89207
89261
|
});
|
|
89208
|
-
editor.version = "2.1.7-beta.
|
|
89262
|
+
editor.version = "2.1.7-beta.33";
|
|
89209
89263
|
return editor;
|
|
89210
89264
|
}
|
|
89211
89265
|
function isDoc(doc2) {
|
|
@@ -89319,7 +89373,7 @@ ${data2.flowchartText}
|
|
|
89319
89373
|
}
|
|
89320
89374
|
}
|
|
89321
89375
|
OnesEditorToolbar.register(editor);
|
|
89322
|
-
editor.version = "2.1.7-beta.
|
|
89376
|
+
editor.version = "2.1.7-beta.33";
|
|
89323
89377
|
return editor;
|
|
89324
89378
|
}
|
|
89325
89379
|
async function showDocVersions(editor, options, serverUrl) {
|