rme 0.2.3-alpha.7 → 0.2.3-alpha.9
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.mjs +37 -33
- package/dist/index.mjs.map +3 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7830,6 +7830,38 @@ var LineBlockquoteExtension = class extends BlockquoteExtension {
|
|
|
7830
7830
|
}
|
|
7831
7831
|
};
|
|
7832
7832
|
|
|
7833
|
+
// src/editor/inline-input-regex/index.ts
|
|
7834
|
+
var getMdImageInputRule = (nodeType) => [
|
|
7835
|
+
{
|
|
7836
|
+
regexp: /!\[([^\]]*)\]\(([^\s"]+(?:\s+[^\s"]+)*)?(?:\s+"(.*?)")?\)/,
|
|
7837
|
+
type: nodeType,
|
|
7838
|
+
getAttributes: (match) => {
|
|
7839
|
+
const [, alt, src, title] = match;
|
|
7840
|
+
return { alt, src, title };
|
|
7841
|
+
}
|
|
7842
|
+
}
|
|
7843
|
+
];
|
|
7844
|
+
var getInlineMathInputRule = (nodeType) => [
|
|
7845
|
+
// Typed inline math trigger: $$ -> insert empty inline math and focus inside
|
|
7846
|
+
{
|
|
7847
|
+
regexp: /\$\$(?!\$)/,
|
|
7848
|
+
type: nodeType,
|
|
7849
|
+
getAttributes: () => ({ tex: "", fromInput: true })
|
|
7850
|
+
},
|
|
7851
|
+
{
|
|
7852
|
+
regexp: /<span[^>]*data-type=["']math-inline["'][^>]*><\/span>/,
|
|
7853
|
+
type: nodeType,
|
|
7854
|
+
getAttributes: () => ({ fromInput: false })
|
|
7855
|
+
},
|
|
7856
|
+
{
|
|
7857
|
+
regexp: /\$([^$\n]+?)\$/,
|
|
7858
|
+
type: nodeType,
|
|
7859
|
+
getAttributes: (match) => {
|
|
7860
|
+
return { tex: match[1] ?? "", fromInput: true };
|
|
7861
|
+
}
|
|
7862
|
+
}
|
|
7863
|
+
];
|
|
7864
|
+
|
|
7833
7865
|
// src/editor/extensions/Clipboard/clipboard-extension.ts
|
|
7834
7866
|
import { extension as extension2, PlainExtension as PlainExtension2 } from "@remirror/core";
|
|
7835
7867
|
import { DOMParser as DOMParser2, Fragment as Fragment2, Slice } from "@remirror/pm/model";
|
|
@@ -7862,6 +7894,7 @@ var ClipboardExtension = class extends PlainExtension2 {
|
|
|
7862
7894
|
return {
|
|
7863
7895
|
props: {
|
|
7864
7896
|
handlePaste: (view, event) => {
|
|
7897
|
+
console.log("handlePaste event", event);
|
|
7865
7898
|
const transformer = getTransformerByView(view);
|
|
7866
7899
|
const parser4 = transformer.stringToDoc;
|
|
7867
7900
|
const schema = view.state.schema;
|
|
@@ -7873,6 +7906,8 @@ var ClipboardExtension = class extends PlainExtension2 {
|
|
|
7873
7906
|
const text = clipboardData.getData("text/plain");
|
|
7874
7907
|
const html2 = clipboardData.getData("text/html");
|
|
7875
7908
|
if (html2.length === 0 && text.length === 0) return false;
|
|
7909
|
+
console.log("html", html2);
|
|
7910
|
+
console.log("text", text);
|
|
7876
7911
|
const domParser = DOMParser2.fromSchema(schema);
|
|
7877
7912
|
let dom;
|
|
7878
7913
|
if (html2.length === 0) {
|
|
@@ -7904,6 +7939,7 @@ var ClipboardExtension = class extends PlainExtension2 {
|
|
|
7904
7939
|
}
|
|
7905
7940
|
const slice = domParser.parseSlice(dom);
|
|
7906
7941
|
const node = isTextOnlySlice(slice);
|
|
7942
|
+
console.log("slice", slice, node);
|
|
7907
7943
|
if (node) {
|
|
7908
7944
|
if ((node.type.name === "html_image" || node.type.name === "md_image") && node.attrs.src) {
|
|
7909
7945
|
this.processImageNode(node, view);
|
|
@@ -7940,7 +7976,7 @@ var ClipboardExtension = class extends PlainExtension2 {
|
|
|
7940
7976
|
async processMarkdownImageSyntax(node, view) {
|
|
7941
7977
|
const { imageCopyHandler } = this.options;
|
|
7942
7978
|
if (!imageCopyHandler) return;
|
|
7943
|
-
const imageRegex =
|
|
7979
|
+
const imageRegex = new RegExp(getMdImageInputRule("md_image")[0]?.regexp, "g");
|
|
7944
7980
|
const processTextNode = async (n2) => {
|
|
7945
7981
|
if (n2.isText && n2.text) {
|
|
7946
7982
|
let match;
|
|
@@ -8353,38 +8389,6 @@ FindExtension = __decorateClass([
|
|
|
8353
8389
|
})
|
|
8354
8390
|
], FindExtension);
|
|
8355
8391
|
|
|
8356
|
-
// src/editor/inline-input-regex/index.ts
|
|
8357
|
-
var getMdImageInputRule = (nodeType) => [
|
|
8358
|
-
{
|
|
8359
|
-
regexp: /!\[([^\]]*)\]\((\S+)?(?:\s+"(.*?)")?\)/,
|
|
8360
|
-
type: nodeType,
|
|
8361
|
-
getAttributes: (match) => {
|
|
8362
|
-
const [, alt, src, title] = match;
|
|
8363
|
-
return { alt, src, title };
|
|
8364
|
-
}
|
|
8365
|
-
}
|
|
8366
|
-
];
|
|
8367
|
-
var getInlineMathInputRule = (nodeType) => [
|
|
8368
|
-
// Typed inline math trigger: $$ -> insert empty inline math and focus inside
|
|
8369
|
-
{
|
|
8370
|
-
regexp: /\$\$(?!\$)/,
|
|
8371
|
-
type: nodeType,
|
|
8372
|
-
getAttributes: () => ({ tex: "", fromInput: true })
|
|
8373
|
-
},
|
|
8374
|
-
{
|
|
8375
|
-
regexp: /<span[^>]*data-type=["']math-inline["'][^>]*><\/span>/,
|
|
8376
|
-
type: nodeType,
|
|
8377
|
-
getAttributes: () => ({ fromInput: false })
|
|
8378
|
-
},
|
|
8379
|
-
{
|
|
8380
|
-
regexp: /\$([^$\n]+?)\$/,
|
|
8381
|
-
type: nodeType,
|
|
8382
|
-
getAttributes: (match) => {
|
|
8383
|
-
return { tex: match[1] ?? "", fromInput: true };
|
|
8384
|
-
}
|
|
8385
|
-
}
|
|
8386
|
-
];
|
|
8387
|
-
|
|
8388
8392
|
// src/editor/extensions/HandleInput/handle-input-extension.ts
|
|
8389
8393
|
import { PlainExtension as PlainExtension4 } from "@remirror/core";
|
|
8390
8394
|
var HandleInputExtension = class extends PlainExtension4 {
|