@underverse-ui/underverse 1.0.134 → 1.0.135
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/api-reference.json +1 -1
- package/dist/index.cjs +24 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/api-reference.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -25508,6 +25508,7 @@ var letter_spacing_default = LetterSpacing;
|
|
|
25508
25508
|
|
|
25509
25509
|
// src/components/UEditor/table-align.ts
|
|
25510
25510
|
var import_extension_table = require("@tiptap/extension-table");
|
|
25511
|
+
var import_state4 = require("@tiptap/pm/state");
|
|
25511
25512
|
|
|
25512
25513
|
// src/components/UEditor/table-align-utils.ts
|
|
25513
25514
|
function findTableNodeInfoAtResolvedPos($pos) {
|
|
@@ -25635,6 +25636,24 @@ var UEditorTable = import_extension_table.Table.extend({
|
|
|
25635
25636
|
return true;
|
|
25636
25637
|
}
|
|
25637
25638
|
};
|
|
25639
|
+
},
|
|
25640
|
+
addProseMirrorPlugins() {
|
|
25641
|
+
return [
|
|
25642
|
+
new import_state4.Plugin({
|
|
25643
|
+
appendTransaction(_transactions, _oldState, newState) {
|
|
25644
|
+
const { doc, schema } = newState;
|
|
25645
|
+
const paragraphType = schema.nodes.paragraph;
|
|
25646
|
+
if (!paragraphType) return null;
|
|
25647
|
+
const needsLeading = doc.firstChild?.type.name === "table";
|
|
25648
|
+
const needsTrailing = doc.lastChild?.type.name === "table";
|
|
25649
|
+
if (!needsLeading && !needsTrailing) return null;
|
|
25650
|
+
const tr = newState.tr;
|
|
25651
|
+
if (needsTrailing) tr.insert(doc.content.size, paragraphType.create());
|
|
25652
|
+
if (needsLeading) tr.insert(0, paragraphType.create());
|
|
25653
|
+
return tr;
|
|
25654
|
+
}
|
|
25655
|
+
})
|
|
25656
|
+
];
|
|
25638
25657
|
}
|
|
25639
25658
|
});
|
|
25640
25659
|
var table_align_default = UEditorTable;
|
|
@@ -26070,7 +26089,7 @@ var EditorColorPalette = ({
|
|
|
26070
26089
|
};
|
|
26071
26090
|
|
|
26072
26091
|
// src/components/UEditor/image-commands.ts
|
|
26073
|
-
var
|
|
26092
|
+
var import_state5 = require("@tiptap/pm/state");
|
|
26074
26093
|
var IMAGE_WIDTHS_BY_LAYOUT = {
|
|
26075
26094
|
block: {
|
|
26076
26095
|
sm: 180,
|
|
@@ -26085,12 +26104,12 @@ var IMAGE_WIDTHS_BY_LAYOUT = {
|
|
|
26085
26104
|
};
|
|
26086
26105
|
function isSelectedImage(editor) {
|
|
26087
26106
|
const { selection } = editor.state;
|
|
26088
|
-
return selection instanceof
|
|
26107
|
+
return selection instanceof import_state5.NodeSelection && selection.node.type.name === "image";
|
|
26089
26108
|
}
|
|
26090
26109
|
function applyImageLayout(editor, layout) {
|
|
26091
26110
|
const { state, view } = editor;
|
|
26092
26111
|
const { selection, schema } = state;
|
|
26093
|
-
if (!(selection instanceof
|
|
26112
|
+
if (!(selection instanceof import_state5.NodeSelection) || selection.node.type.name !== "image") {
|
|
26094
26113
|
editor.chain().focus().updateAttributes("image", { imageLayout: layout }).run();
|
|
26095
26114
|
return;
|
|
26096
26115
|
}
|
|
@@ -26108,10 +26127,10 @@ function applyImageLayout(editor, layout) {
|
|
|
26108
26127
|
}
|
|
26109
26128
|
}
|
|
26110
26129
|
const resolvedPos = transaction.doc.resolve(Math.min(nextPos + 1, transaction.doc.content.size));
|
|
26111
|
-
transaction = transaction.setSelection(
|
|
26130
|
+
transaction = transaction.setSelection(import_state5.TextSelection.near(resolvedPos));
|
|
26112
26131
|
} else {
|
|
26113
26132
|
const resolvedPos = transaction.doc.resolve(selection.from);
|
|
26114
|
-
transaction = transaction.setSelection(
|
|
26133
|
+
transaction = transaction.setSelection(import_state5.NodeSelection.create(transaction.doc, resolvedPos.pos));
|
|
26115
26134
|
}
|
|
26116
26135
|
view.dispatch(transaction.scrollIntoView());
|
|
26117
26136
|
view.focus();
|