@mdxeditor/editor 0.10.0-alpha.1 → 0.10.0-alpha.2
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/MDXEditor.js +1 -1
- package/dist/importMarkdownToLexical.js +1 -1
- package/dist/plugins/diff-source/SourceEditor.js +2 -0
- package/dist/plugins/image/ImageEditor.d.ts +3 -1
- package/dist/plugins/image/ImageEditor.js +29 -6
- package/dist/plugins/image/ImageNode.d.ts +11 -1
- package/dist/plugins/image/ImageNode.js +37 -9
- package/dist/plugins/image/ImageResizer.d.ts +18 -0
- package/dist/plugins/image/ImageResizer.js +214 -0
- package/dist/plugins/image/LexicalImageVisitor.js +27 -6
- package/dist/plugins/image/MdastImageVisitor.d.ts +3 -0
- package/dist/plugins/image/MdastImageVisitor.js +72 -1
- package/dist/plugins/image/index.js +3 -1
- package/dist/plugins/jsx/MdastMdxJsxElementVisitor.js +1 -1
- package/dist/plugins/table/TableEditor.js +25 -15
- package/dist/style.css +232 -158
- package/dist/styles/ui.module.css.js +105 -75
- package/dist/utils/lexicalHelpers.js +2 -2
- package/package.json +2 -1
|
@@ -77,18 +77,26 @@ const TableEditor = ({ mdastNode, parentEditor, lexicalTable }) => {
|
|
|
77
77
|
React__default.useEffect(() => {
|
|
78
78
|
lexicalTable.focusEmitter.subscribe(setActiveCellWithBoundaries);
|
|
79
79
|
}, [lexicalTable, setActiveCellWithBoundaries]);
|
|
80
|
-
const addRowToBottom = React__default.useCallback(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
const addRowToBottom = React__default.useCallback(
|
|
81
|
+
(e) => {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
parentEditor.update(() => {
|
|
84
|
+
lexicalTable.addRowToBottom();
|
|
85
|
+
setActiveCell([0, lexicalTable.getRowCount()]);
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
[parentEditor, lexicalTable]
|
|
89
|
+
);
|
|
90
|
+
const addColumnToRight = React__default.useCallback(
|
|
91
|
+
(e) => {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
parentEditor.update(() => {
|
|
94
|
+
lexicalTable.addColumnToRight();
|
|
95
|
+
setActiveCell([lexicalTable.getColCount(), 0]);
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
[parentEditor, lexicalTable]
|
|
99
|
+
);
|
|
92
100
|
const [highlightedCoordinates, setHighlightedCoordinates] = React__default.useState([-1, -1]);
|
|
93
101
|
const onTableMouseOver = React__default.useCallback((e) => {
|
|
94
102
|
let tableCell = e.target;
|
|
@@ -116,8 +124,10 @@ const TableEditor = ({ mdastNode, parentEditor, lexicalTable }) => {
|
|
|
116
124
|
"button",
|
|
117
125
|
{
|
|
118
126
|
className: styles.iconButton,
|
|
127
|
+
type: "button",
|
|
119
128
|
title: "Delete table",
|
|
120
|
-
onClick: () => {
|
|
129
|
+
onClick: (e) => {
|
|
130
|
+
e.preventDefault();
|
|
121
131
|
parentEditor.update(() => {
|
|
122
132
|
lexicalTable.selectNext();
|
|
123
133
|
lexicalTable.remove();
|
|
@@ -158,8 +168,8 @@ const TableEditor = ({ mdastNode, parentEditor, lexicalTable }) => {
|
|
|
158
168
|
}
|
|
159
169
|
}
|
|
160
170
|
);
|
|
161
|
-
}), rowIndex === 0 && /* @__PURE__ */ React__default.createElement("th", { rowSpan: lexicalTable.getRowCount(), "data-tool-cell": true }, /* @__PURE__ */ React__default.createElement("button", { className: styles.addColumnButton, onClick: addColumnToRight }, /* @__PURE__ */ React__default.createElement(AddColumnIcon, null))));
|
|
162
|
-
})), /* @__PURE__ */ React__default.createElement("tfoot", null, /* @__PURE__ */ React__default.createElement("tr", null, /* @__PURE__ */ React__default.createElement("th", null), /* @__PURE__ */ React__default.createElement("th", { colSpan: lexicalTable.getColCount() }, /* @__PURE__ */ React__default.createElement("button", { className: styles.addRowButton, onClick: addRowToBottom }, /* @__PURE__ */ React__default.createElement(AddRowIcon, null))), /* @__PURE__ */ React__default.createElement("th", null))));
|
|
171
|
+
}), rowIndex === 0 && /* @__PURE__ */ React__default.createElement("th", { rowSpan: lexicalTable.getRowCount(), "data-tool-cell": true }, /* @__PURE__ */ React__default.createElement("button", { type: "button", className: styles.addColumnButton, onClick: addColumnToRight }, /* @__PURE__ */ React__default.createElement(AddColumnIcon, null))));
|
|
172
|
+
})), /* @__PURE__ */ React__default.createElement("tfoot", null, /* @__PURE__ */ React__default.createElement("tr", null, /* @__PURE__ */ React__default.createElement("th", null), /* @__PURE__ */ React__default.createElement("th", { colSpan: lexicalTable.getColCount() }, /* @__PURE__ */ React__default.createElement("button", { type: "button", className: styles.addRowButton, onClick: addRowToBottom }, /* @__PURE__ */ React__default.createElement(AddRowIcon, null))), /* @__PURE__ */ React__default.createElement("th", null))));
|
|
163
173
|
};
|
|
164
174
|
const Cell = ({ align, ...props }) => {
|
|
165
175
|
const { activeCell, setActiveCell } = props;
|