rme 0.0.72 → 0.0.74
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 +273 -217
- package/dist/index.mjs.map +4 -4
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -4455,6 +4455,9 @@ function getTagName(str) {
|
|
|
4455
4455
|
}
|
|
4456
4456
|
return "";
|
|
4457
4457
|
}
|
|
4458
|
+
function isImageElement(el) {
|
|
4459
|
+
return el && el.tagName?.toLocaleUpperCase() === "IMG";
|
|
4460
|
+
}
|
|
4458
4461
|
function buildHtmlStringFromAst(ast) {
|
|
4459
4462
|
let attrs = "";
|
|
4460
4463
|
if (ast.attrs) {
|
|
@@ -5305,21 +5308,21 @@ import { isTextSelection as isTextSelection2, PlainExtension as PlainExtension2
|
|
|
5305
5308
|
import { Decoration as Decoration2, DecorationSet as DecorationSet2 } from "@remirror/pm/view";
|
|
5306
5309
|
|
|
5307
5310
|
// src/editor/extensions/Inline/inline-mark-extensions.ts
|
|
5308
|
-
import { MarkExtension
|
|
5311
|
+
import { MarkExtension, extension, keyBinding } from "@remirror/core";
|
|
5309
5312
|
|
|
5310
5313
|
// src/editor/extensions/Inline/format-href.ts
|
|
5311
|
-
function formatHref(
|
|
5312
|
-
if (isUnixFilePath(
|
|
5313
|
-
return formatFileUrl(
|
|
5314
|
+
function formatHref(location2) {
|
|
5315
|
+
if (isUnixFilePath(location2) || isWindowsFilePath(location2)) {
|
|
5316
|
+
return formatFileUrl(location2);
|
|
5314
5317
|
} else {
|
|
5315
|
-
return
|
|
5318
|
+
return location2;
|
|
5316
5319
|
}
|
|
5317
5320
|
}
|
|
5318
|
-
function isUnixFilePath(
|
|
5319
|
-
return
|
|
5321
|
+
function isUnixFilePath(location2) {
|
|
5322
|
+
return location2.startsWith("/");
|
|
5320
5323
|
}
|
|
5321
|
-
function isWindowsFilePath(
|
|
5322
|
-
return
|
|
5324
|
+
function isWindowsFilePath(location2) {
|
|
5325
|
+
return location2.startsWith("\\") || /^[A-Z]{1,2}:/.test(location2);
|
|
5323
5326
|
}
|
|
5324
5327
|
function formatFileUrl(filePath) {
|
|
5325
5328
|
let pathName = filePath;
|
|
@@ -5538,6 +5541,8 @@ import { gfmStrikethroughFromMarkdown } from "mdast-util-gfm-strikethrough";
|
|
|
5538
5541
|
import { gfmAutolinkLiteral } from "micromark-extension-gfm-autolink-literal";
|
|
5539
5542
|
import { gfmStrikethrough } from "micromark-extension-gfm-strikethrough";
|
|
5540
5543
|
import { nanoid } from "nanoid";
|
|
5544
|
+
import voidElements from "void-elements";
|
|
5545
|
+
import { cloneDeep } from "lodash";
|
|
5541
5546
|
gfmAutolinkLiteralFromMarkdown.transforms = [];
|
|
5542
5547
|
function fixMarkNames(marks) {
|
|
5543
5548
|
if (marks.length <= 1)
|
|
@@ -5850,136 +5855,115 @@ function parseMdInline(phrasingContents, depth = 1) {
|
|
|
5850
5855
|
}
|
|
5851
5856
|
return inlineTokens;
|
|
5852
5857
|
}
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
for (let i =
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5858
|
+
function mergePhrasingContents(phrasingContents, startIndex, endIndex) {
|
|
5859
|
+
const merged = cloneDeep(phrasingContents[startIndex]);
|
|
5860
|
+
for (let i = startIndex + 1; i <= endIndex; i++) {
|
|
5861
|
+
merged.value += phrasingContents[i].value || "";
|
|
5862
|
+
merged.position.end = phrasingContents[i].position.end;
|
|
5863
|
+
merged.complete = true;
|
|
5864
|
+
}
|
|
5865
|
+
phrasingContents.splice(startIndex, endIndex - startIndex + 1, merged);
|
|
5866
|
+
return phrasingContents;
|
|
5867
|
+
}
|
|
5868
|
+
function getMergeArr(phrasingContents) {
|
|
5869
|
+
const unCloseedHtmlStack = [];
|
|
5870
|
+
const mergeArr = [];
|
|
5871
|
+
for (let i = 0; i < phrasingContents.length; i++) {
|
|
5872
|
+
const phrasingContent = phrasingContents[i];
|
|
5873
|
+
if (phrasingContent.type === "html") {
|
|
5874
|
+
const tagName = getTagName(phrasingContent.value);
|
|
5875
|
+
const htmlNode = {
|
|
5876
|
+
tag: tagName,
|
|
5877
|
+
voidElement: !!voidElements[tagName],
|
|
5878
|
+
isClosingTag: isClosingTag(phrasingContent.value),
|
|
5879
|
+
index: i
|
|
5880
|
+
};
|
|
5881
|
+
if (!htmlNode.voidElement) {
|
|
5882
|
+
if (!htmlNode.isClosingTag) {
|
|
5883
|
+
unCloseedHtmlStack.push(htmlNode);
|
|
5884
|
+
} else if (unCloseedHtmlStack[unCloseedHtmlStack.length - 1]?.tag === htmlNode.tag) {
|
|
5885
|
+
if (unCloseedHtmlStack.length >= 1) {
|
|
5886
|
+
mergeArr.push([unCloseedHtmlStack.pop(), htmlNode]);
|
|
5887
|
+
phrasingContent.complete = true;
|
|
5888
|
+
}
|
|
5874
5889
|
}
|
|
5890
|
+
} else {
|
|
5891
|
+
phrasingContent.complete = true;
|
|
5875
5892
|
}
|
|
5876
5893
|
}
|
|
5877
5894
|
}
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5895
|
+
for (let i = 0; i < mergeArr.length; i++) {
|
|
5896
|
+
const merge = mergeArr[i];
|
|
5897
|
+
const startIndex = merge[0].index;
|
|
5898
|
+
const endIndex = merge[1].index;
|
|
5899
|
+
const parentNode = mergeArr.findIndex(
|
|
5900
|
+
(item) => item[0].index < startIndex && item[1].index > endIndex
|
|
5901
|
+
);
|
|
5902
|
+
if (parentNode >= 0) {
|
|
5903
|
+
mergeArr.splice(i, 1);
|
|
5904
|
+
i--;
|
|
5886
5905
|
}
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
};
|
|
5917
|
-
markHtmlTokens(allTokens, 1);
|
|
5918
|
-
const res = [];
|
|
5919
|
-
allTokens.forEach((token) => {
|
|
5920
|
-
if (token.type === "html") {
|
|
5921
|
-
if (token.complete) {
|
|
5922
|
-
res.push({
|
|
5923
|
-
marks: ["mdMark"],
|
|
5906
|
+
}
|
|
5907
|
+
return mergeArr;
|
|
5908
|
+
}
|
|
5909
|
+
function mergeHtmlPhrasingContents(phrasingContents) {
|
|
5910
|
+
const mergeArr = getMergeArr(phrasingContents);
|
|
5911
|
+
let offset = 0;
|
|
5912
|
+
mergeArr.forEach((merge) => {
|
|
5913
|
+
const startIndex = merge[0].index + offset;
|
|
5914
|
+
const endIndex = merge[1].index + offset;
|
|
5915
|
+
mergePhrasingContents(phrasingContents, startIndex, endIndex);
|
|
5916
|
+
offset += startIndex - endIndex;
|
|
5917
|
+
});
|
|
5918
|
+
}
|
|
5919
|
+
function hasHtmlToken(mdastToken) {
|
|
5920
|
+
for (const token of mdastToken) {
|
|
5921
|
+
if (token.type === "html" && !needSplitInlineHtmlTokenTags.includes(getTagName(token.value))) {
|
|
5922
|
+
return true;
|
|
5923
|
+
}
|
|
5924
|
+
}
|
|
5925
|
+
return false;
|
|
5926
|
+
}
|
|
5927
|
+
function flatHTMLInlineCode(phrasingContents, depth = 1) {
|
|
5928
|
+
mergeHtmlPhrasingContents(phrasingContents);
|
|
5929
|
+
const inlineTokens = [];
|
|
5930
|
+
phrasingContents.forEach((phrascontent) => {
|
|
5931
|
+
if (phrascontent.type === "html") {
|
|
5932
|
+
if (phrascontent.complete) {
|
|
5933
|
+
inlineTokens.push({
|
|
5934
|
+
marks: ["mdHtmlInline"],
|
|
5924
5935
|
attrs: {
|
|
5925
|
-
depth:
|
|
5926
|
-
|
|
5927
|
-
|
|
5936
|
+
depth: 1,
|
|
5937
|
+
htmlText: phrascontent.value,
|
|
5938
|
+
key: nanoid(),
|
|
5939
|
+
first: true,
|
|
5940
|
+
last: true
|
|
5928
5941
|
},
|
|
5929
|
-
start:
|
|
5930
|
-
end:
|
|
5942
|
+
start: phrascontent.position.start.offset,
|
|
5943
|
+
end: phrascontent.position.end.offset
|
|
5931
5944
|
});
|
|
5932
5945
|
} else {
|
|
5933
|
-
|
|
5946
|
+
inlineTokens.push({
|
|
5934
5947
|
marks: ["mdText"],
|
|
5935
|
-
attrs: {
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
last: true,
|
|
5939
|
-
class: "html_tag"
|
|
5940
|
-
},
|
|
5941
|
-
start: token.position?.start?.offset,
|
|
5942
|
-
end: token.position?.end?.offset
|
|
5948
|
+
attrs: { depth, first: true, last: true },
|
|
5949
|
+
start: phrascontent.position.start.offset,
|
|
5950
|
+
end: phrascontent.position.end.offset
|
|
5943
5951
|
});
|
|
5944
5952
|
}
|
|
5945
5953
|
} else {
|
|
5946
|
-
const
|
|
5947
|
-
|
|
5948
|
-
for (const node of nodes) {
|
|
5949
|
-
node.marks.push("mdHtmlInline");
|
|
5950
|
-
node.attrs.htmlSpec = token.htmlSpec;
|
|
5951
|
-
}
|
|
5952
|
-
}
|
|
5953
|
-
res.push(...nodes);
|
|
5954
|
+
const tokens = flatPhrasingContent(phrascontent, depth);
|
|
5955
|
+
inlineTokens.push(...fixTokensMarkNames(tokens));
|
|
5954
5956
|
}
|
|
5955
5957
|
});
|
|
5956
|
-
return
|
|
5957
|
-
}
|
|
5958
|
-
function hasHtmlToken(mdastToken) {
|
|
5959
|
-
for (const token of mdastToken) {
|
|
5960
|
-
if (token.type === "html" && !needSplitInlineHtmlTokenTags.includes(getTagName(token.value))) {
|
|
5961
|
-
return true;
|
|
5962
|
-
}
|
|
5963
|
-
}
|
|
5964
|
-
return false;
|
|
5958
|
+
return inlineTokens;
|
|
5965
5959
|
}
|
|
5966
5960
|
function fromInlineMarkdown(text) {
|
|
5967
5961
|
const phrasingContents = parseInlineMarkdown(text);
|
|
5968
5962
|
if (hasHtmlToken(phrasingContents)) {
|
|
5969
|
-
|
|
5970
|
-
return nodes;
|
|
5963
|
+
return flatHTMLInlineCode(phrasingContents);
|
|
5971
5964
|
}
|
|
5972
|
-
|
|
5973
|
-
return tokens;
|
|
5965
|
+
return parseMdInline(phrasingContents);
|
|
5974
5966
|
}
|
|
5975
|
-
var canCreateDomTagName = (tagName) => {
|
|
5976
|
-
try {
|
|
5977
|
-
document.createElement(tagName);
|
|
5978
|
-
return true;
|
|
5979
|
-
} catch (error) {
|
|
5980
|
-
return false;
|
|
5981
|
-
}
|
|
5982
|
-
};
|
|
5983
5967
|
|
|
5984
5968
|
// src/editor/extensions/Inline/inline-mark-helpers.ts
|
|
5985
5969
|
function parseTextBlock(schema, node, startPos, output) {
|
|
@@ -6202,58 +6186,6 @@ function deleteTextBlockChild(tr, textBlockNode, textBlockStart, childIndex) {
|
|
|
6202
6186
|
return tr.delete(offset, offset + textBlockNode.child(childIndex).nodeSize);
|
|
6203
6187
|
}
|
|
6204
6188
|
|
|
6205
|
-
// src/editor/extensions/HtmlNode/html-inline-marks.ts
|
|
6206
|
-
import { extension, MarkExtension } from "remirror";
|
|
6207
|
-
var HtmlInlineMarks = class extends MarkExtension {
|
|
6208
|
-
get name() {
|
|
6209
|
-
return "mdHtmlInline";
|
|
6210
|
-
}
|
|
6211
|
-
createMarkSpec() {
|
|
6212
|
-
return {
|
|
6213
|
-
spanning: false,
|
|
6214
|
-
attrs: {
|
|
6215
|
-
depth: { default: 0 },
|
|
6216
|
-
first: { default: false },
|
|
6217
|
-
last: { default: false },
|
|
6218
|
-
htmlSpec: { default: [] }
|
|
6219
|
-
},
|
|
6220
|
-
toDOM: (mark) => {
|
|
6221
|
-
const htmlSpec = mark.attrs.htmlSpec.filter(
|
|
6222
|
-
(spec) => canCreateDomTagName(spec.tagName)
|
|
6223
|
-
);
|
|
6224
|
-
if (htmlSpec.length >= 1) {
|
|
6225
|
-
const getDomSpec = (spec) => {
|
|
6226
|
-
const curSpec = spec[0];
|
|
6227
|
-
const res = [curSpec.tagName];
|
|
6228
|
-
if (curSpec.attrs) {
|
|
6229
|
-
res.push(curSpec.attrs);
|
|
6230
|
-
}
|
|
6231
|
-
if (spec.length > 1) {
|
|
6232
|
-
res.push(getDomSpec(spec.slice(1)));
|
|
6233
|
-
} else {
|
|
6234
|
-
res.push(0);
|
|
6235
|
-
}
|
|
6236
|
-
return res;
|
|
6237
|
-
};
|
|
6238
|
-
return getDomSpec(htmlSpec);
|
|
6239
|
-
}
|
|
6240
|
-
return ["span"];
|
|
6241
|
-
}
|
|
6242
|
-
};
|
|
6243
|
-
}
|
|
6244
|
-
};
|
|
6245
|
-
HtmlInlineMarks.disableExtraAttributes = true;
|
|
6246
|
-
HtmlInlineMarks = __decorateClass([
|
|
6247
|
-
extension({
|
|
6248
|
-
defaultOptions: {
|
|
6249
|
-
handleViewImgSrcUrl: async (src) => src
|
|
6250
|
-
},
|
|
6251
|
-
staticKeys: [],
|
|
6252
|
-
handlerKeys: [],
|
|
6253
|
-
customHandlerKeys: []
|
|
6254
|
-
})
|
|
6255
|
-
], HtmlInlineMarks);
|
|
6256
|
-
|
|
6257
6189
|
// src/editor/extensions/Inline/inline-mark-extensions.ts
|
|
6258
6190
|
var commonAttrs = {
|
|
6259
6191
|
depth: { default: 0 }
|
|
@@ -6264,7 +6196,7 @@ var endpointAttrs = {
|
|
|
6264
6196
|
last: { default: false },
|
|
6265
6197
|
class: { default: "" }
|
|
6266
6198
|
};
|
|
6267
|
-
var MetaKey = class extends
|
|
6199
|
+
var MetaKey = class extends MarkExtension {
|
|
6268
6200
|
static {
|
|
6269
6201
|
this.disableExtraAttributes = true;
|
|
6270
6202
|
}
|
|
@@ -6284,7 +6216,7 @@ var MetaKey = class extends MarkExtension2 {
|
|
|
6284
6216
|
};
|
|
6285
6217
|
}
|
|
6286
6218
|
};
|
|
6287
|
-
var PlainText = class extends
|
|
6219
|
+
var PlainText = class extends MarkExtension {
|
|
6288
6220
|
static {
|
|
6289
6221
|
this.disableExtraAttributes = true;
|
|
6290
6222
|
}
|
|
@@ -6298,7 +6230,7 @@ var PlainText = class extends MarkExtension2 {
|
|
|
6298
6230
|
};
|
|
6299
6231
|
}
|
|
6300
6232
|
};
|
|
6301
|
-
var Emphasis = class extends
|
|
6233
|
+
var Emphasis = class extends MarkExtension {
|
|
6302
6234
|
static {
|
|
6303
6235
|
this.disableExtraAttributes = true;
|
|
6304
6236
|
}
|
|
@@ -6318,7 +6250,7 @@ var Emphasis = class extends MarkExtension2 {
|
|
|
6318
6250
|
__decorateClass([
|
|
6319
6251
|
keyBinding({ shortcut: "mod-i", command: "toggleEmphasis" })
|
|
6320
6252
|
], Emphasis.prototype, "shortcut", 1);
|
|
6321
|
-
var Strong = class extends
|
|
6253
|
+
var Strong = class extends MarkExtension {
|
|
6322
6254
|
static {
|
|
6323
6255
|
this.disableExtraAttributes = true;
|
|
6324
6256
|
}
|
|
@@ -6338,7 +6270,7 @@ var Strong = class extends MarkExtension2 {
|
|
|
6338
6270
|
__decorateClass([
|
|
6339
6271
|
keyBinding({ shortcut: "mod-b", command: "toggleStrong" })
|
|
6340
6272
|
], Strong.prototype, "shortcut", 1);
|
|
6341
|
-
var CodeText = class extends
|
|
6273
|
+
var CodeText = class extends MarkExtension {
|
|
6342
6274
|
static {
|
|
6343
6275
|
this.disableExtraAttributes = true;
|
|
6344
6276
|
}
|
|
@@ -6358,7 +6290,7 @@ var CodeText = class extends MarkExtension2 {
|
|
|
6358
6290
|
__decorateClass([
|
|
6359
6291
|
keyBinding({ shortcut: "mod-e", command: "toggleCodeText" })
|
|
6360
6292
|
], CodeText.prototype, "shortcut", 1);
|
|
6361
|
-
var CodeSpace = class extends
|
|
6293
|
+
var CodeSpace = class extends MarkExtension {
|
|
6362
6294
|
static {
|
|
6363
6295
|
this.disableExtraAttributes = true;
|
|
6364
6296
|
}
|
|
@@ -6372,7 +6304,7 @@ var CodeSpace = class extends MarkExtension2 {
|
|
|
6372
6304
|
};
|
|
6373
6305
|
}
|
|
6374
6306
|
};
|
|
6375
|
-
var Delete = class extends
|
|
6307
|
+
var Delete = class extends MarkExtension {
|
|
6376
6308
|
static {
|
|
6377
6309
|
this.disableExtraAttributes = true;
|
|
6378
6310
|
}
|
|
@@ -6392,7 +6324,7 @@ var Delete = class extends MarkExtension2 {
|
|
|
6392
6324
|
__decorateClass([
|
|
6393
6325
|
keyBinding({ shortcut: "mod-shift-s", command: "toggleDelete" })
|
|
6394
6326
|
], Delete.prototype, "shortcut", 1);
|
|
6395
|
-
var LinkText = class extends
|
|
6327
|
+
var LinkText = class extends MarkExtension {
|
|
6396
6328
|
static {
|
|
6397
6329
|
this.disableExtraAttributes = true;
|
|
6398
6330
|
}
|
|
@@ -6417,7 +6349,7 @@ var LinkText = class extends MarkExtension2 {
|
|
|
6417
6349
|
};
|
|
6418
6350
|
}
|
|
6419
6351
|
};
|
|
6420
|
-
var LinkUri = class extends
|
|
6352
|
+
var LinkUri = class extends MarkExtension {
|
|
6421
6353
|
static {
|
|
6422
6354
|
this.disableExtraAttributes = true;
|
|
6423
6355
|
}
|
|
@@ -6432,7 +6364,7 @@ var LinkUri = class extends MarkExtension2 {
|
|
|
6432
6364
|
};
|
|
6433
6365
|
}
|
|
6434
6366
|
};
|
|
6435
|
-
var ImgText = class extends
|
|
6367
|
+
var ImgText = class extends MarkExtension {
|
|
6436
6368
|
static {
|
|
6437
6369
|
this.disableExtraAttributes = true;
|
|
6438
6370
|
}
|
|
@@ -6448,7 +6380,7 @@ var ImgText = class extends MarkExtension2 {
|
|
|
6448
6380
|
}
|
|
6449
6381
|
};
|
|
6450
6382
|
var globalImageHrefCache = /* @__PURE__ */ new Map();
|
|
6451
|
-
var ImgUri = class extends
|
|
6383
|
+
var ImgUri = class extends MarkExtension {
|
|
6452
6384
|
constructor() {
|
|
6453
6385
|
super(...arguments);
|
|
6454
6386
|
this.createNodeViews = () => {
|
|
@@ -6496,7 +6428,7 @@ var ImgUri = class extends MarkExtension2 {
|
|
|
6496
6428
|
};
|
|
6497
6429
|
ImgUri.disableExtraAttributes = true;
|
|
6498
6430
|
ImgUri = __decorateClass([
|
|
6499
|
-
|
|
6431
|
+
extension({
|
|
6500
6432
|
defaultOptions: {
|
|
6501
6433
|
handleViewImgSrcUrl: async (src) => src
|
|
6502
6434
|
},
|
|
@@ -6528,8 +6460,8 @@ var markExtensions = (options = {}) => [
|
|
|
6528
6460
|
new ImgText(),
|
|
6529
6461
|
new ImgUri({
|
|
6530
6462
|
handleViewImgSrcUrl: options.handleViewImgSrcUrl
|
|
6531
|
-
})
|
|
6532
|
-
new HtmlInlineMarks()
|
|
6463
|
+
})
|
|
6464
|
+
// new HtmlInlineMarks(),
|
|
6533
6465
|
];
|
|
6534
6466
|
|
|
6535
6467
|
// src/editor/extensions/Inline/inline-deco-extension.ts
|
|
@@ -6939,7 +6871,7 @@ var import_escape_string_regexp = __toESM(require_escape_string_regexp(), 1);
|
|
|
6939
6871
|
var import_string_prototype = __toESM(require_string_prototype2(), 1);
|
|
6940
6872
|
import {
|
|
6941
6873
|
command,
|
|
6942
|
-
extension as
|
|
6874
|
+
extension as extension3,
|
|
6943
6875
|
helper,
|
|
6944
6876
|
PlainExtension as PlainExtension5
|
|
6945
6877
|
} from "@remirror/core";
|
|
@@ -7302,8 +7234,57 @@ var WysiwygThemeWrapper = styled.div.attrs((p) => ({
|
|
|
7302
7234
|
padding: 0;
|
|
7303
7235
|
}
|
|
7304
7236
|
|
|
7237
|
+
|
|
7305
7238
|
& input[type='checkbox'] {
|
|
7306
|
-
|
|
7239
|
+
/* Add if not using autoprefixer */
|
|
7240
|
+
-webkit-appearance: none;
|
|
7241
|
+
/* Remove most all native input styles */
|
|
7242
|
+
appearance: none;
|
|
7243
|
+
/* Not removed via appearance */
|
|
7244
|
+
margin: 0;
|
|
7245
|
+
|
|
7246
|
+
font: inherit;
|
|
7247
|
+
color: currentColor;
|
|
7248
|
+
width: 1.15em;
|
|
7249
|
+
height: 1.15em;
|
|
7250
|
+
border: 1px solid currentColor;
|
|
7251
|
+
border-radius: 4px;
|
|
7252
|
+
transform: translateY(0.25em);
|
|
7253
|
+
|
|
7254
|
+
display: grid;
|
|
7255
|
+
place-content: center;
|
|
7256
|
+
}
|
|
7257
|
+
|
|
7258
|
+
& input[type='checkbox']:checked {
|
|
7259
|
+
background-color: ${(props) => props.theme.accentColor};
|
|
7260
|
+
}
|
|
7261
|
+
|
|
7262
|
+
& input[type='checkbox']:checked::before {
|
|
7263
|
+
transform: scale(1);
|
|
7264
|
+
}
|
|
7265
|
+
|
|
7266
|
+
& input[type='checkbox']::before {
|
|
7267
|
+
content: '';
|
|
7268
|
+
width: 0.75em;
|
|
7269
|
+
height: 0.75em;
|
|
7270
|
+
clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
|
|
7271
|
+
transform: scale(0);
|
|
7272
|
+
transform-origin: bottom left;
|
|
7273
|
+
transition: 120ms transform ease-in-out;
|
|
7274
|
+
/* Windows High Contrast Mode */
|
|
7275
|
+
background-color: CanvasText;
|
|
7276
|
+
}
|
|
7277
|
+
|
|
7278
|
+
& input[type='checkbox']:focus {
|
|
7279
|
+
outline: max(2px, 0.15em) solid currentColor;
|
|
7280
|
+
outline-offset: max(2px, 0.15em);
|
|
7281
|
+
}
|
|
7282
|
+
|
|
7283
|
+
& input[type='checkbox']:disabled {
|
|
7284
|
+
--form-control-color: #eee;
|
|
7285
|
+
|
|
7286
|
+
color: #eee;
|
|
7287
|
+
cursor: not-allowed;
|
|
7307
7288
|
}
|
|
7308
7289
|
|
|
7309
7290
|
& a:focus,
|
|
@@ -8754,7 +8735,7 @@ var defaultIgnoredKeys = [
|
|
|
8754
8735
|
];
|
|
8755
8736
|
|
|
8756
8737
|
// src/editor/extensions/SlashMenu/slashmenu-extension.ts
|
|
8757
|
-
import { PlainExtension as PlainExtension4, extension as
|
|
8738
|
+
import { PlainExtension as PlainExtension4, extension as extension2 } from "remirror";
|
|
8758
8739
|
|
|
8759
8740
|
// src/editor/extensions/SlashMenu/case.ts
|
|
8760
8741
|
var defaultConditions = (openInSelection = false) => {
|
|
@@ -8887,7 +8868,7 @@ var SlashMenuExtension = class extends PlainExtension4 {
|
|
|
8887
8868
|
}
|
|
8888
8869
|
};
|
|
8889
8870
|
SlashMenuExtension = __decorateClass([
|
|
8890
|
-
|
|
8871
|
+
extension2({
|
|
8891
8872
|
defaultOptions: {}
|
|
8892
8873
|
})
|
|
8893
8874
|
], SlashMenuExtension);
|
|
@@ -9557,7 +9538,7 @@ __decorateClass([
|
|
|
9557
9538
|
helper()
|
|
9558
9539
|
], FindExtension.prototype, "findRanges", 1);
|
|
9559
9540
|
FindExtension = __decorateClass([
|
|
9560
|
-
|
|
9541
|
+
extension3({
|
|
9561
9542
|
defaultOptions: {
|
|
9562
9543
|
decoration: { style: "background-color: yellow;" },
|
|
9563
9544
|
activeDecoration: { style: "background-color: orange;" },
|
|
@@ -16645,7 +16626,7 @@ var LineHtmlBlockExtension = class extends NodeExtension {
|
|
|
16645
16626
|
import {
|
|
16646
16627
|
command as command2,
|
|
16647
16628
|
ErrorConstant as ErrorConstant2,
|
|
16648
|
-
extension as
|
|
16629
|
+
extension as extension4,
|
|
16649
16630
|
ExtensionTag,
|
|
16650
16631
|
getTextSelection,
|
|
16651
16632
|
invariant,
|
|
@@ -16659,7 +16640,7 @@ import { insertPoint } from "@remirror/pm/transform";
|
|
|
16659
16640
|
import { ExtensionImageTheme } from "@remirror/theme";
|
|
16660
16641
|
|
|
16661
16642
|
// src/editor/extensions/Image/image-nodeview.tsx
|
|
16662
|
-
import { Image, Popover } from "zens";
|
|
16643
|
+
import { Image as ZensImage, Popover } from "zens";
|
|
16663
16644
|
|
|
16664
16645
|
// src/editor/extensions/Image/image-tool-tips.tsx
|
|
16665
16646
|
import { useState as useState6 } from "react";
|
|
@@ -17207,7 +17188,6 @@ import { jsx as jsx15 } from "react/jsx-runtime";
|
|
|
17207
17188
|
var warningFallBack = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAAAAACIM/FCAAAChElEQVR4Ae3aMW/TQBxAcb70k91AAiGuGlZAtOlQApWaDiSdklZq2RPUTm1xUWL3PgqSpygkXlh88N54nn7S2Trd3y/CP5IQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECPmPIEKECBEiRIgQIeX82+FBO0naB4eTRRkt5P7sNWt1Rw9RQvKThI2SYR4f5OoVW2rfRAYpT6hqHc8WeVHki9mgRdWwiAmyfA9AdrlaW5tlAHxcxQMpK8feRbGxPEkrSREN5ARg/y780V0GMIwFcgXwLg9byvsAN3FA8lfAfr7jYQZ0nqKAfAb21vYVwNruSoEvMUDuE+Ai7IKECZA+RAA5A7JiN6TMgFHzIeUb4DLshoQZ0H1uPGQOvFzVQZYtYNF4yBg4DnWQMAAmjYccArN6yBQ4ajzkAFjUQ+ZAv/GQNpDXQ3Kg03hIAhT1kAJIhLi1/vJl39Ic6Mf3+a2K8PM7BgahtgEwjuKI0lqGjSI8opRdYFb3sk/jODSGEZCVuyFFDzgPzYc8JMBkN2QMpI8RQMIQ2LvdBblNgdM4Lh/aQJaHrf3sAe2nKCDhGqCfb3VEcx1UNQTItlzQ3fYAvoZYIMUHgHRSbiyPU4BPZUSX2JWEbLZcW5v2qByrmMYKxZCq1mA6z4sin08HLapOy8gGPddtttT5HuHobZiwUXr6K85h6KjLWm/PH+MdTy/GR/12knb6g8mPZ38YECJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAh0fUb5q7oCGreEVEAAAAASUVORK5CYII=";
|
|
17208
17189
|
function ImageNodeView(props) {
|
|
17209
17190
|
const { node, selected, updateAttributes, handleViewImgSrcUrl } = props;
|
|
17210
|
-
const [src, setSrc] = useState8("");
|
|
17211
17191
|
const initRef = useRef5();
|
|
17212
17192
|
const popoverStore = useRef5();
|
|
17213
17193
|
const [open, setOpen] = useState8(selected);
|
|
@@ -17217,26 +17197,36 @@ function ImageNodeView(props) {
|
|
|
17217
17197
|
}
|
|
17218
17198
|
setOpen(selected);
|
|
17219
17199
|
}, [selected]);
|
|
17220
|
-
useEffect6(() => {
|
|
17221
|
-
if (handleViewImgSrcUrl) {
|
|
17222
|
-
handleViewImgSrcUrl(node.attrs.src).then((newSrc) => {
|
|
17223
|
-
setSrc(newSrc);
|
|
17224
|
-
});
|
|
17225
|
-
} else {
|
|
17226
|
-
setSrc(node.attrs.src);
|
|
17227
|
-
}
|
|
17228
|
-
}, [handleViewImgSrcUrl, node.attrs.src]);
|
|
17229
17200
|
const handleStoreChange = (store) => popoverStore.current = store;
|
|
17230
|
-
const Main =
|
|
17231
|
-
|
|
17201
|
+
const Main = /* @__PURE__ */ jsx15(Resizable, { controlInit: (init) => initRef.current = init, ...props, children: /* @__PURE__ */ jsx15(
|
|
17202
|
+
ZensImage,
|
|
17232
17203
|
{
|
|
17233
|
-
fallback: warningFallBack,
|
|
17234
17204
|
onLoad: () => initRef.current?.(),
|
|
17235
|
-
|
|
17236
|
-
|
|
17237
|
-
|
|
17205
|
+
src: node.attrs.src,
|
|
17206
|
+
imgPromise: (src) => {
|
|
17207
|
+
return new Promise((resolve, reject) => {
|
|
17208
|
+
const makeImageLoad = (targetSrc) => {
|
|
17209
|
+
const img = new Image();
|
|
17210
|
+
img.src = targetSrc;
|
|
17211
|
+
img.onload = () => {
|
|
17212
|
+
resolve(targetSrc);
|
|
17213
|
+
};
|
|
17214
|
+
img.onerror = () => {
|
|
17215
|
+
reject(warningFallBack);
|
|
17216
|
+
};
|
|
17217
|
+
};
|
|
17218
|
+
if (handleViewImgSrcUrl) {
|
|
17219
|
+
handleViewImgSrcUrl(node.attrs.src).then((newSrc) => {
|
|
17220
|
+
makeImageLoad(newSrc);
|
|
17221
|
+
});
|
|
17222
|
+
} else {
|
|
17223
|
+
makeImageLoad(node.attrs.src);
|
|
17224
|
+
}
|
|
17225
|
+
});
|
|
17226
|
+
},
|
|
17227
|
+
...node.attrs
|
|
17238
17228
|
}
|
|
17239
|
-
) })
|
|
17229
|
+
) });
|
|
17240
17230
|
if (!open) {
|
|
17241
17231
|
return Main;
|
|
17242
17232
|
}
|
|
@@ -17431,7 +17421,7 @@ __decorateClass([
|
|
|
17431
17421
|
command2()
|
|
17432
17422
|
], HtmlImageExtension.prototype, "uploadImage", 1);
|
|
17433
17423
|
HtmlImageExtension = __decorateClass([
|
|
17434
|
-
|
|
17424
|
+
extension4({
|
|
17435
17425
|
defaultOptions: {
|
|
17436
17426
|
createPlaceholder,
|
|
17437
17427
|
handleViewImgSrcUrl: async (src) => src,
|
|
@@ -17507,7 +17497,7 @@ var import_querystringify = __toESM(require_querystringify(), 1);
|
|
|
17507
17497
|
import {
|
|
17508
17498
|
command as command3,
|
|
17509
17499
|
cx as cx2,
|
|
17510
|
-
extension as
|
|
17500
|
+
extension as extension5,
|
|
17511
17501
|
ExtensionTag as ExtensionTag2,
|
|
17512
17502
|
findSelectedNodeOfType,
|
|
17513
17503
|
NodeExtension as NodeExtension3,
|
|
@@ -17670,7 +17660,7 @@ __decorateClass([
|
|
|
17670
17660
|
command3()
|
|
17671
17661
|
], IframeExtension.prototype, "updateYouTubeVideo", 1);
|
|
17672
17662
|
IframeExtension = __decorateClass([
|
|
17673
|
-
|
|
17663
|
+
extension5({
|
|
17674
17664
|
defaultOptions: {
|
|
17675
17665
|
defaultSource: "",
|
|
17676
17666
|
class: "remirror-iframe",
|
|
@@ -17711,7 +17701,7 @@ function createYouTubeUrl(props) {
|
|
|
17711
17701
|
}
|
|
17712
17702
|
|
|
17713
17703
|
// src/editor/extensions/Placeholder/index.ts
|
|
17714
|
-
import { extension as
|
|
17704
|
+
import { extension as extension6, ManagerPhase, PlainExtension as PlainExtension6 } from "@remirror/core";
|
|
17715
17705
|
import { Decoration as Decoration4, DecorationSet as DecorationSet4 } from "@remirror/pm/view";
|
|
17716
17706
|
import { ExtensionPlaceholderTheme } from "@remirror/theme";
|
|
17717
17707
|
var PlaceholderExtension = class extends PlainExtension6 {
|
|
@@ -17736,7 +17726,7 @@ var PlaceholderExtension = class extends PlainExtension6 {
|
|
|
17736
17726
|
}
|
|
17737
17727
|
};
|
|
17738
17728
|
PlaceholderExtension = __decorateClass([
|
|
17739
|
-
|
|
17729
|
+
extension6({
|
|
17740
17730
|
defaultOptions: {
|
|
17741
17731
|
emptyNodeClass: ExtensionPlaceholderTheme.IS_EMPTY,
|
|
17742
17732
|
placeholder: ""
|
|
@@ -17764,7 +17754,7 @@ function createDecorationSet(props) {
|
|
|
17764
17754
|
|
|
17765
17755
|
// src/editor/extensions/Clipboard/clipboard-extension.ts
|
|
17766
17756
|
import { PlainExtension as PlainExtension7 } from "@remirror/core";
|
|
17767
|
-
import { DOMSerializer, DOMParser } from "@remirror/pm/model";
|
|
17757
|
+
import { DOMSerializer, DOMParser as DOMParser2 } from "@remirror/pm/model";
|
|
17768
17758
|
function isPureText(content) {
|
|
17769
17759
|
if (!content)
|
|
17770
17760
|
return false;
|
|
@@ -17812,7 +17802,7 @@ var ClipboardExtension = class extends PlainExtension7 {
|
|
|
17812
17802
|
const html2 = clipboardData.getData("text/html");
|
|
17813
17803
|
if (html2.length === 0 && text.length === 0)
|
|
17814
17804
|
return false;
|
|
17815
|
-
const domParser =
|
|
17805
|
+
const domParser = DOMParser2.fromSchema(schema);
|
|
17816
17806
|
let dom;
|
|
17817
17807
|
if (html2.length === 0) {
|
|
17818
17808
|
const slice2 = parser4?.(text);
|
|
@@ -17852,7 +17842,7 @@ var ClipboardExtension = class extends PlainExtension7 {
|
|
|
17852
17842
|
};
|
|
17853
17843
|
|
|
17854
17844
|
// src/editor/extensions/HtmlBr/br-extension.ts
|
|
17855
|
-
import { extension as
|
|
17845
|
+
import { extension as extension7, ExtensionTag as ExtensionTag3, NodeExtension as NodeExtension4 } from "@remirror/core";
|
|
17856
17846
|
var HtmlBrExtension = class extends NodeExtension4 {
|
|
17857
17847
|
get name() {
|
|
17858
17848
|
return "html_br";
|
|
@@ -17892,11 +17882,74 @@ var HtmlBrExtension = class extends NodeExtension4 {
|
|
|
17892
17882
|
};
|
|
17893
17883
|
HtmlBrExtension.disableExtraAttributes = true;
|
|
17894
17884
|
HtmlBrExtension = __decorateClass([
|
|
17895
|
-
|
|
17885
|
+
extension7({
|
|
17896
17886
|
defaultOptions: {}
|
|
17897
17887
|
})
|
|
17898
17888
|
], HtmlBrExtension);
|
|
17899
17889
|
|
|
17890
|
+
// src/editor/extensions/HtmlNode/html-inline-extension.ts
|
|
17891
|
+
import { MarkExtension as MarkExtension2, extension as extension8 } from "remirror";
|
|
17892
|
+
var LineHtmlInlineExtension = class extends MarkExtension2 {
|
|
17893
|
+
get name() {
|
|
17894
|
+
return "mdHtmlInline";
|
|
17895
|
+
}
|
|
17896
|
+
createMarkSpec() {
|
|
17897
|
+
return {
|
|
17898
|
+
attrs: {
|
|
17899
|
+
depth: { default: 0 },
|
|
17900
|
+
key: {
|
|
17901
|
+
default: ""
|
|
17902
|
+
},
|
|
17903
|
+
htmlText: {
|
|
17904
|
+
default: ""
|
|
17905
|
+
}
|
|
17906
|
+
},
|
|
17907
|
+
toDOM: (mark) => [
|
|
17908
|
+
"span",
|
|
17909
|
+
{
|
|
17910
|
+
...mark.attrs
|
|
17911
|
+
},
|
|
17912
|
+
0
|
|
17913
|
+
]
|
|
17914
|
+
};
|
|
17915
|
+
}
|
|
17916
|
+
createNodeViews() {
|
|
17917
|
+
return (node) => {
|
|
17918
|
+
const container = document.createElement("span");
|
|
17919
|
+
const domParser = new DOMParser();
|
|
17920
|
+
const doc = domParser.parseFromString(node.attrs.htmlText || "", "text/html");
|
|
17921
|
+
doc.body.childNodes.forEach((child) => {
|
|
17922
|
+
if (isImageElement(child) && child.src && this.options.handleViewImgSrcUrl) {
|
|
17923
|
+
let targetUrl = child.src;
|
|
17924
|
+
if (child.src.includes(location.origin)) {
|
|
17925
|
+
targetUrl = child.src.split(location.origin)[1];
|
|
17926
|
+
}
|
|
17927
|
+
this.options.handleViewImgSrcUrl(targetUrl).then((newHref) => {
|
|
17928
|
+
child.src = newHref;
|
|
17929
|
+
});
|
|
17930
|
+
}
|
|
17931
|
+
container.appendChild(child);
|
|
17932
|
+
});
|
|
17933
|
+
const contentDom = document.createElement("span");
|
|
17934
|
+
container.appendChild(contentDom);
|
|
17935
|
+
container.setAttribute("key", node.attrs.key);
|
|
17936
|
+
contentDom.setAttribute("class", "md-html-inline");
|
|
17937
|
+
return {
|
|
17938
|
+
dom: container,
|
|
17939
|
+
contentDOM: contentDom
|
|
17940
|
+
};
|
|
17941
|
+
};
|
|
17942
|
+
}
|
|
17943
|
+
};
|
|
17944
|
+
LineHtmlInlineExtension.disableExtraAttributes = true;
|
|
17945
|
+
LineHtmlInlineExtension = __decorateClass([
|
|
17946
|
+
extension8({
|
|
17947
|
+
defaultOptions: {
|
|
17948
|
+
handleViewImgSrcUrl: async (src) => src
|
|
17949
|
+
}
|
|
17950
|
+
})
|
|
17951
|
+
], LineHtmlInlineExtension);
|
|
17952
|
+
|
|
17900
17953
|
// src/editor/extensions/index.ts
|
|
17901
17954
|
function extensions({ handleViewImgSrcUrl }) {
|
|
17902
17955
|
return [
|
|
@@ -17912,6 +17965,9 @@ function extensions({ handleViewImgSrcUrl }) {
|
|
|
17912
17965
|
new IframeExtension({
|
|
17913
17966
|
enableResizing: true
|
|
17914
17967
|
}),
|
|
17968
|
+
new LineHtmlInlineExtension({
|
|
17969
|
+
handleViewImgSrcUrl
|
|
17970
|
+
}),
|
|
17915
17971
|
new PlaceholderExtension({ placeholder: "Type '/' for commands" }),
|
|
17916
17972
|
new LineHorizontalRuleExtension({}),
|
|
17917
17973
|
new LineParagraphExtension(),
|