rme 0.2.3-alpha.6 → 0.2.3-alpha.8
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 +42 -35
- package/dist/index.mjs.map +4 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6205,6 +6205,8 @@ var Text_default = Text;
|
|
|
6205
6205
|
import { ProsemirrorDevTools } from "@remirror/dev";
|
|
6206
6206
|
|
|
6207
6207
|
// src/editor/components/SourceEditor/delegate.ts
|
|
6208
|
+
import { markdown } from "@codemirror/lang-markdown";
|
|
6209
|
+
import { CountExtension as CountExtension2 } from "@remirror/extension-count";
|
|
6208
6210
|
import { createReactManager } from "@remirror/react";
|
|
6209
6211
|
import { DocExtension } from "remirror/extensions";
|
|
6210
6212
|
|
|
@@ -6821,6 +6823,12 @@ var MarkdownParser = class {
|
|
|
6821
6823
|
constructor(schema, parserRules) {
|
|
6822
6824
|
this.schema = schema;
|
|
6823
6825
|
this.tokenizer = MarkdownIt("commonmark", { html: true }).disable(["emphasis", "autolink", "backticks", "entity", "reference", "link"]).enable(["table"]).use(markdown_it_html_inline_default).use(markdown_it_list_checkbox_default).use(markdown_it_mermaid_default).use(MarkdownItMath).use(MarkdownItImage);
|
|
6826
|
+
this.tokenizer.validateLink = (url) => {
|
|
6827
|
+
if (url.startsWith("data:")) {
|
|
6828
|
+
return true;
|
|
6829
|
+
}
|
|
6830
|
+
return MarkdownIt().validateLink(url);
|
|
6831
|
+
};
|
|
6824
6832
|
this.tokenHandlers = buildTokenHandlers(schema, parserRules);
|
|
6825
6833
|
}
|
|
6826
6834
|
parse(text) {
|
|
@@ -7822,6 +7830,38 @@ var LineBlockquoteExtension = class extends BlockquoteExtension {
|
|
|
7822
7830
|
}
|
|
7823
7831
|
};
|
|
7824
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
|
+
|
|
7825
7865
|
// src/editor/extensions/Clipboard/clipboard-extension.ts
|
|
7826
7866
|
import { extension as extension2, PlainExtension as PlainExtension2 } from "@remirror/core";
|
|
7827
7867
|
import { DOMParser as DOMParser2, Fragment as Fragment2, Slice } from "@remirror/pm/model";
|
|
@@ -7932,7 +7972,7 @@ var ClipboardExtension = class extends PlainExtension2 {
|
|
|
7932
7972
|
async processMarkdownImageSyntax(node, view) {
|
|
7933
7973
|
const { imageCopyHandler } = this.options;
|
|
7934
7974
|
if (!imageCopyHandler) return;
|
|
7935
|
-
const imageRegex =
|
|
7975
|
+
const imageRegex = new RegExp(getMdImageInputRule("md_image")[0]?.regexp, "g");
|
|
7936
7976
|
const processTextNode = async (n2) => {
|
|
7937
7977
|
if (n2.isText && n2.text) {
|
|
7938
7978
|
let match;
|
|
@@ -8345,38 +8385,6 @@ FindExtension = __decorateClass([
|
|
|
8345
8385
|
})
|
|
8346
8386
|
], FindExtension);
|
|
8347
8387
|
|
|
8348
|
-
// src/editor/inline-input-regex/index.ts
|
|
8349
|
-
var getMdImageInputRule = (nodeType) => [
|
|
8350
|
-
{
|
|
8351
|
-
regexp: /!\[([^\]]*)\]\((\S+)?(?:\s+"(.*?)")?\)/,
|
|
8352
|
-
type: nodeType,
|
|
8353
|
-
getAttributes: (match) => {
|
|
8354
|
-
const [, alt, src, title] = match;
|
|
8355
|
-
return { alt, src, title };
|
|
8356
|
-
}
|
|
8357
|
-
}
|
|
8358
|
-
];
|
|
8359
|
-
var getInlineMathInputRule = (nodeType) => [
|
|
8360
|
-
// Typed inline math trigger: $$ -> insert empty inline math and focus inside
|
|
8361
|
-
{
|
|
8362
|
-
regexp: /\$\$(?!\$)/,
|
|
8363
|
-
type: nodeType,
|
|
8364
|
-
getAttributes: () => ({ tex: "", fromInput: true })
|
|
8365
|
-
},
|
|
8366
|
-
{
|
|
8367
|
-
regexp: /<span[^>]*data-type=["']math-inline["'][^>]*><\/span>/,
|
|
8368
|
-
type: nodeType,
|
|
8369
|
-
getAttributes: () => ({ fromInput: false })
|
|
8370
|
-
},
|
|
8371
|
-
{
|
|
8372
|
-
regexp: /\$([^$\n]+?)\$/,
|
|
8373
|
-
type: nodeType,
|
|
8374
|
-
getAttributes: (match) => {
|
|
8375
|
-
return { tex: match[1] ?? "", fromInput: true };
|
|
8376
|
-
}
|
|
8377
|
-
}
|
|
8378
|
-
];
|
|
8379
|
-
|
|
8380
8388
|
// src/editor/extensions/HandleInput/handle-input-extension.ts
|
|
8381
8389
|
import { PlainExtension as PlainExtension4 } from "@remirror/core";
|
|
8382
8390
|
var HandleInputExtension = class extends PlainExtension4 {
|
|
@@ -24439,14 +24447,13 @@ LineCodeMirrorExtension = __decorateClass([
|
|
|
24439
24447
|
], LineCodeMirrorExtension);
|
|
24440
24448
|
|
|
24441
24449
|
// src/editor/components/SourceEditor/delegate.ts
|
|
24442
|
-
import { markdown } from "@codemirror/lang-markdown";
|
|
24443
|
-
import { CountExtension as CountExtension2 } from "@remirror/extension-count";
|
|
24444
24450
|
function createSourceCodeManager(options) {
|
|
24445
24451
|
return createReactManager(() => [
|
|
24446
24452
|
new CountExtension2({}),
|
|
24447
24453
|
new DocExtension({ content: "codeMirror" }),
|
|
24448
24454
|
new LineCodeMirrorExtension({
|
|
24449
24455
|
hideDecoration: true,
|
|
24456
|
+
showCopyButton: false,
|
|
24450
24457
|
extensions: [basicSetup, markdown()],
|
|
24451
24458
|
onCodemirrorViewLoad: options?.onCodemirrorViewLoad
|
|
24452
24459
|
})
|