rme 0.0.13 → 0.0.16
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 +201 -1213
- package/dist/index.mjs.map +4 -4
- package/package.json +14 -8
package/dist/index.mjs
CHANGED
|
@@ -655,36 +655,36 @@ var require_implementation2 = __commonJS({
|
|
|
655
655
|
return false;
|
|
656
656
|
}
|
|
657
657
|
};
|
|
658
|
-
keysShim = function keys(
|
|
659
|
-
var isObject =
|
|
660
|
-
var isFunction2 = toStr.call(
|
|
661
|
-
var isArguments = isArgs(
|
|
662
|
-
var isString3 = isObject && toStr.call(
|
|
658
|
+
keysShim = function keys(object2) {
|
|
659
|
+
var isObject = object2 !== null && typeof object2 === "object";
|
|
660
|
+
var isFunction2 = toStr.call(object2) === "[object Function]";
|
|
661
|
+
var isArguments = isArgs(object2);
|
|
662
|
+
var isString3 = isObject && toStr.call(object2) === "[object String]";
|
|
663
663
|
var theKeys = [];
|
|
664
664
|
if (!isObject && !isFunction2 && !isArguments) {
|
|
665
665
|
throw new TypeError("Object.keys called on a non-object");
|
|
666
666
|
}
|
|
667
667
|
var skipProto = hasProtoEnumBug && isFunction2;
|
|
668
|
-
if (isString3 &&
|
|
669
|
-
for (var i = 0; i <
|
|
668
|
+
if (isString3 && object2.length > 0 && !has.call(object2, 0)) {
|
|
669
|
+
for (var i = 0; i < object2.length; ++i) {
|
|
670
670
|
theKeys.push(String(i));
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
|
-
if (isArguments &&
|
|
674
|
-
for (var j = 0; j <
|
|
673
|
+
if (isArguments && object2.length > 0) {
|
|
674
|
+
for (var j = 0; j < object2.length; ++j) {
|
|
675
675
|
theKeys.push(String(j));
|
|
676
676
|
}
|
|
677
677
|
} else {
|
|
678
|
-
for (var name in
|
|
679
|
-
if (!(skipProto && name === "prototype") && has.call(
|
|
678
|
+
for (var name in object2) {
|
|
679
|
+
if (!(skipProto && name === "prototype") && has.call(object2, name)) {
|
|
680
680
|
theKeys.push(String(name));
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
684
|
if (hasDontEnumBug) {
|
|
685
|
-
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(
|
|
685
|
+
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object2);
|
|
686
686
|
for (var k = 0; k < dontEnums.length; ++k) {
|
|
687
|
-
if (!(skipConstructor && dontEnums[k] === "constructor") && has.call(
|
|
687
|
+
if (!(skipConstructor && dontEnums[k] === "constructor") && has.call(object2, dontEnums[k])) {
|
|
688
688
|
theKeys.push(dontEnums[k]);
|
|
689
689
|
}
|
|
690
690
|
}
|
|
@@ -726,11 +726,11 @@ var require_object_keys = __commonJS({
|
|
|
726
726
|
return args && args.length === arguments.length;
|
|
727
727
|
}(1, 2);
|
|
728
728
|
if (!keysWorksWithArguments) {
|
|
729
|
-
Object.keys = function keys(
|
|
730
|
-
if (isArgs(
|
|
731
|
-
return originalKeys(slice.call(
|
|
729
|
+
Object.keys = function keys(object2) {
|
|
730
|
+
if (isArgs(object2)) {
|
|
731
|
+
return originalKeys(slice.call(object2));
|
|
732
732
|
}
|
|
733
|
-
return originalKeys(
|
|
733
|
+
return originalKeys(object2);
|
|
734
734
|
};
|
|
735
735
|
}
|
|
736
736
|
} else {
|
|
@@ -788,10 +788,10 @@ var require_define_properties = __commonJS({
|
|
|
788
788
|
};
|
|
789
789
|
var hasPropertyDescriptors = (0, import_has_property_descriptors.default)();
|
|
790
790
|
var supportsDescriptors = origDefineProperty && hasPropertyDescriptors;
|
|
791
|
-
var defineProperty = function(
|
|
792
|
-
if (name in
|
|
791
|
+
var defineProperty = function(object2, name, value, predicate) {
|
|
792
|
+
if (name in object2) {
|
|
793
793
|
if (predicate === true) {
|
|
794
|
-
if (
|
|
794
|
+
if (object2[name] === value) {
|
|
795
795
|
return;
|
|
796
796
|
}
|
|
797
797
|
} else if (!isFunction2(predicate) || !predicate()) {
|
|
@@ -799,24 +799,24 @@ var require_define_properties = __commonJS({
|
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
801
|
if (supportsDescriptors) {
|
|
802
|
-
origDefineProperty(
|
|
802
|
+
origDefineProperty(object2, name, {
|
|
803
803
|
configurable: true,
|
|
804
804
|
enumerable: false,
|
|
805
805
|
value,
|
|
806
806
|
writable: true
|
|
807
807
|
});
|
|
808
808
|
} else {
|
|
809
|
-
|
|
809
|
+
object2[name] = value;
|
|
810
810
|
}
|
|
811
811
|
};
|
|
812
|
-
var defineProperties = function(
|
|
812
|
+
var defineProperties = function(object2, map) {
|
|
813
813
|
var predicates = arguments.length > 2 ? arguments[2] : {};
|
|
814
814
|
var props = keys(map);
|
|
815
815
|
if (hasSymbols) {
|
|
816
816
|
props = concat.call(props, Object.getOwnPropertySymbols(map));
|
|
817
817
|
}
|
|
818
818
|
for (var i = 0; i < props.length; i += 1) {
|
|
819
|
-
defineProperty(
|
|
819
|
+
defineProperty(object2, props[i], map[props[i]], predicates[props[i]]);
|
|
820
820
|
}
|
|
821
821
|
};
|
|
822
822
|
defineProperties.supportsDescriptors = !!supportsDescriptors;
|
|
@@ -3195,18 +3195,18 @@ var require_es_set_tostringtag = __commonJS({
|
|
|
3195
3195
|
var hasToStringTag = (0, import_shams.default)();
|
|
3196
3196
|
var has = import_has.default;
|
|
3197
3197
|
var toStringTag = hasToStringTag ? Symbol.toStringTag : null;
|
|
3198
|
-
module.exports = function setToStringTag(
|
|
3198
|
+
module.exports = function setToStringTag(object2, value) {
|
|
3199
3199
|
var overrideIfSet = arguments.length > 2 && arguments[2] && arguments[2].force;
|
|
3200
|
-
if (toStringTag && (overrideIfSet || !has(
|
|
3200
|
+
if (toStringTag && (overrideIfSet || !has(object2, toStringTag))) {
|
|
3201
3201
|
if ($defineProperty) {
|
|
3202
|
-
$defineProperty(
|
|
3202
|
+
$defineProperty(object2, toStringTag, {
|
|
3203
3203
|
configurable: true,
|
|
3204
3204
|
enumerable: false,
|
|
3205
3205
|
value,
|
|
3206
3206
|
writable: false
|
|
3207
3207
|
});
|
|
3208
3208
|
} else {
|
|
3209
|
-
|
|
3209
|
+
object2[toStringTag] = value;
|
|
3210
3210
|
}
|
|
3211
3211
|
}
|
|
3212
3212
|
};
|
|
@@ -3960,9 +3960,9 @@ var require_cjs = __commonJS({
|
|
|
3960
3960
|
function getKeys(target) {
|
|
3961
3961
|
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
3962
3962
|
}
|
|
3963
|
-
function propertyIsOnObject(
|
|
3963
|
+
function propertyIsOnObject(object2, property) {
|
|
3964
3964
|
try {
|
|
3965
|
-
return property in
|
|
3965
|
+
return property in object2;
|
|
3966
3966
|
} catch (_) {
|
|
3967
3967
|
return false;
|
|
3968
3968
|
}
|
|
@@ -4663,1033 +4663,21 @@ var MarkdownParser = class {
|
|
|
4663
4663
|
}
|
|
4664
4664
|
};
|
|
4665
4665
|
|
|
4666
|
-
// node_modules/@remirror/extension-tables/dist/remirror-extension-tables.js
|
|
4667
|
-
import {
|
|
4668
|
-
command,
|
|
4669
|
-
convertCommand,
|
|
4670
|
-
extension,
|
|
4671
|
-
ExtensionPriority,
|
|
4672
|
-
ExtensionTag as ExtensionTag2,
|
|
4673
|
-
findParentNodeOfType as findParentNodeOfType2,
|
|
4674
|
-
helper,
|
|
4675
|
-
isElementDomNode,
|
|
4676
|
-
keyBinding,
|
|
4677
|
-
NodeExtension,
|
|
4678
|
-
nonChainable
|
|
4679
|
-
} from "@remirror/core";
|
|
4680
|
-
import { TextSelection } from "@remirror/pm/state";
|
|
4681
|
-
import {
|
|
4682
|
-
addColumnAfter,
|
|
4683
|
-
addColumnBefore,
|
|
4684
|
-
addRowAfter,
|
|
4685
|
-
addRowBefore,
|
|
4686
|
-
CellSelection,
|
|
4687
|
-
columnIsHeader,
|
|
4688
|
-
columnResizing,
|
|
4689
|
-
deleteColumn,
|
|
4690
|
-
deleteRow,
|
|
4691
|
-
deleteTable,
|
|
4692
|
-
fixTables,
|
|
4693
|
-
fixTablesKey,
|
|
4694
|
-
goToNextCell,
|
|
4695
|
-
isCellSelection,
|
|
4696
|
-
mergeCells,
|
|
4697
|
-
rowIsHeader,
|
|
4698
|
-
setCellAttr,
|
|
4699
|
-
splitCell,
|
|
4700
|
-
tableEditing,
|
|
4701
|
-
TableMap,
|
|
4702
|
-
TableView,
|
|
4703
|
-
toggleHeader,
|
|
4704
|
-
toggleHeaderCell,
|
|
4705
|
-
toggleHeaderColumn,
|
|
4706
|
-
toggleHeaderRow,
|
|
4707
|
-
updateColumnsOnResize
|
|
4708
|
-
} from "@remirror/pm/tables";
|
|
4709
|
-
import {
|
|
4710
|
-
ErrorConstant,
|
|
4711
|
-
ExtensionTag,
|
|
4712
|
-
findParentNodeOfType,
|
|
4713
|
-
includes,
|
|
4714
|
-
invariant,
|
|
4715
|
-
object,
|
|
4716
|
-
values
|
|
4717
|
-
} from "@remirror/core";
|
|
4718
|
-
|
|
4719
|
-
// node_modules/@remirror/messages/dist/remirror-messages.js
|
|
4720
|
-
var CREATE_COMMAND_LABEL = (
|
|
4721
|
-
/*i18n*/
|
|
4722
|
-
{
|
|
4723
|
-
id: "extension.command.create-table.label",
|
|
4724
|
-
message: "Create table",
|
|
4725
|
-
comment: "Label for creating a table"
|
|
4726
|
-
}
|
|
4727
|
-
);
|
|
4728
|
-
var CREATE_COMMAND_DESCRIPTION = (
|
|
4729
|
-
/*i18n*/
|
|
4730
|
-
{
|
|
4731
|
-
id: "extension.command.create-table.description",
|
|
4732
|
-
message: "Create a table with set number of rows and columns.",
|
|
4733
|
-
comment: "Description for creating a table"
|
|
4734
|
-
}
|
|
4735
|
-
);
|
|
4736
|
-
var COLUMN_COUNT = (
|
|
4737
|
-
/*i18n*/
|
|
4738
|
-
{
|
|
4739
|
-
id: "extension.table.column_count",
|
|
4740
|
-
message: "{count, plural, one {# column} other {# columns}}",
|
|
4741
|
-
comment: "The number of columns"
|
|
4742
|
-
}
|
|
4743
|
-
);
|
|
4744
|
-
var ROW_COUNT = (
|
|
4745
|
-
/*i18n*/
|
|
4746
|
-
{
|
|
4747
|
-
id: "extension.table.row_count",
|
|
4748
|
-
message: "{count, plural, one {# row} other {# rows}}",
|
|
4749
|
-
comment: "The number of rows"
|
|
4750
|
-
}
|
|
4751
|
-
);
|
|
4752
|
-
var extensionTablesMessages = /* @__PURE__ */ Object.freeze({
|
|
4753
|
-
__proto__: null,
|
|
4754
|
-
COLUMN_COUNT,
|
|
4755
|
-
CREATE_COMMAND_DESCRIPTION,
|
|
4756
|
-
CREATE_COMMAND_LABEL,
|
|
4757
|
-
ROW_COUNT
|
|
4758
|
-
});
|
|
4759
|
-
|
|
4760
|
-
// node_modules/@remirror/extension-tables/dist/remirror-extension-tables.js
|
|
4761
|
-
import {
|
|
4762
|
-
isElementDomNode as isElementDomNode2,
|
|
4763
|
-
mergeDOMRects
|
|
4764
|
-
} from "@remirror/core";
|
|
4765
|
-
import {
|
|
4766
|
-
defaultAbsolutePosition,
|
|
4767
|
-
hasStateChanged,
|
|
4768
|
-
isPositionVisible,
|
|
4769
|
-
Positioner
|
|
4770
|
-
} from "@remirror/extension-positioner";
|
|
4771
|
-
import { isCellSelection as isCellSelection2, TableMap as TableMap2 } from "@remirror/pm/tables";
|
|
4772
|
-
var __defProp2 = Object.defineProperty;
|
|
4773
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
4774
|
-
var __decorateClass2 = (decorators, target, key, kind) => {
|
|
4775
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc2(target, key) : target;
|
|
4776
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4777
|
-
if (decorator = decorators[i])
|
|
4778
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4779
|
-
if (kind && result)
|
|
4780
|
-
__defProp2(target, key, result);
|
|
4781
|
-
return result;
|
|
4782
|
-
};
|
|
4783
|
-
function getCellAttrs(dom) {
|
|
4784
|
-
const widthAttr = dom.getAttribute("data-colwidth");
|
|
4785
|
-
const widths = widthAttr && /^\d+(,\d+)*$/.test(widthAttr) ? widthAttr.split(",").map((s) => Number(s)) : null;
|
|
4786
|
-
const colspan = Number(dom.getAttribute("colspan") ?? 1);
|
|
4787
|
-
const backgroundColor = dom.getAttribute("data-background-color");
|
|
4788
|
-
return {
|
|
4789
|
-
colspan,
|
|
4790
|
-
rowspan: Number(dom.getAttribute("rowspan") ?? 1),
|
|
4791
|
-
colwidth: widths && widths.length === colspan ? widths : null,
|
|
4792
|
-
background: backgroundColor || dom.style.backgroundColor || null
|
|
4793
|
-
};
|
|
4794
|
-
}
|
|
4795
|
-
function setCellAttrs(node) {
|
|
4796
|
-
const attrs = {};
|
|
4797
|
-
if (node.attrs.colspan !== 1) {
|
|
4798
|
-
attrs.colspan = node.attrs.colspan;
|
|
4799
|
-
}
|
|
4800
|
-
if (node.attrs.rowspan !== 1) {
|
|
4801
|
-
attrs.rowspan = node.attrs.rowspan;
|
|
4802
|
-
}
|
|
4803
|
-
if (node.attrs.colwidth) {
|
|
4804
|
-
attrs["data-colwidth"] = node.attrs.colwidth.join(",");
|
|
4805
|
-
}
|
|
4806
|
-
if (node.attrs.background) {
|
|
4807
|
-
attrs.style = `${node.attrs.style ?? ""}background-color: ${node.attrs.background};`;
|
|
4808
|
-
attrs["data-background-color"] = node.attrs.background;
|
|
4809
|
-
}
|
|
4810
|
-
return attrs;
|
|
4811
|
-
}
|
|
4812
|
-
function createTableNodeSchema(extra, override) {
|
|
4813
|
-
const cellAttrs = {
|
|
4814
|
-
...extra.defaults(),
|
|
4815
|
-
colspan: { default: 1 },
|
|
4816
|
-
rowspan: { default: 1 },
|
|
4817
|
-
colwidth: { default: null },
|
|
4818
|
-
background: { default: null }
|
|
4819
|
-
};
|
|
4820
|
-
return {
|
|
4821
|
-
table: {
|
|
4822
|
-
isolating: true,
|
|
4823
|
-
...override,
|
|
4824
|
-
attrs: extra.defaults(),
|
|
4825
|
-
content: "tableRow+",
|
|
4826
|
-
tableRole: "table",
|
|
4827
|
-
parseDOM: [{ tag: "table", getAttrs: extra.parse }, ...override.parseDOM ?? []],
|
|
4828
|
-
toDOM(node) {
|
|
4829
|
-
return ["table", extra.dom(node), ["tbody", 0]];
|
|
4830
|
-
}
|
|
4831
|
-
},
|
|
4832
|
-
tableRow: {
|
|
4833
|
-
...override,
|
|
4834
|
-
attrs: extra.defaults(),
|
|
4835
|
-
content: "(tableCell | tableHeaderCell)*",
|
|
4836
|
-
tableRole: "row",
|
|
4837
|
-
parseDOM: [{ tag: "tr", getAttrs: extra.parse }, ...override.parseDOM ?? []],
|
|
4838
|
-
toDOM(node) {
|
|
4839
|
-
return ["tr", extra.dom(node), 0];
|
|
4840
|
-
}
|
|
4841
|
-
},
|
|
4842
|
-
tableCell: {
|
|
4843
|
-
isolating: true,
|
|
4844
|
-
content: `${ExtensionTag.Block}+`,
|
|
4845
|
-
...override,
|
|
4846
|
-
attrs: cellAttrs,
|
|
4847
|
-
tableRole: "cell",
|
|
4848
|
-
parseDOM: [
|
|
4849
|
-
{
|
|
4850
|
-
tag: "td",
|
|
4851
|
-
getAttrs: (dom) => ({ ...extra.parse(dom), ...getCellAttrs(dom) })
|
|
4852
|
-
},
|
|
4853
|
-
...override.parseDOM ?? []
|
|
4854
|
-
],
|
|
4855
|
-
toDOM(node) {
|
|
4856
|
-
return ["td", { ...extra.dom(node), ...setCellAttrs(node) }, 0];
|
|
4857
|
-
}
|
|
4858
|
-
},
|
|
4859
|
-
tableHeaderCell: {
|
|
4860
|
-
isolating: true,
|
|
4861
|
-
content: `${ExtensionTag.Block}+`,
|
|
4862
|
-
...override,
|
|
4863
|
-
attrs: cellAttrs,
|
|
4864
|
-
tableRole: "header_cell",
|
|
4865
|
-
parseDOM: [
|
|
4866
|
-
{
|
|
4867
|
-
tag: "th",
|
|
4868
|
-
getAttrs: (dom) => ({ ...extra.parse(dom), ...getCellAttrs(dom) })
|
|
4869
|
-
},
|
|
4870
|
-
...override.parseDOM ?? []
|
|
4871
|
-
],
|
|
4872
|
-
toDOM(node) {
|
|
4873
|
-
return ["th", { ...extra.dom(node), ...setCellAttrs(node) }, 0];
|
|
4874
|
-
}
|
|
4875
|
-
}
|
|
4876
|
-
};
|
|
4877
|
-
}
|
|
4878
|
-
var TABLE_ROLES = ["table", "row", "cell", "header_cell"];
|
|
4879
|
-
function tableNodeTypes(schema) {
|
|
4880
|
-
if (schema.cached.tableNodeTypes) {
|
|
4881
|
-
return schema.cached.tableNodeTypes;
|
|
4882
|
-
}
|
|
4883
|
-
const roles = object();
|
|
4884
|
-
schema.cached.tableNodeTypes = roles;
|
|
4885
|
-
for (const nodeType of values(schema.nodes)) {
|
|
4886
|
-
if (includes(TABLE_ROLES, nodeType.spec.tableRole)) {
|
|
4887
|
-
roles[nodeType.spec.tableRole] = nodeType;
|
|
4888
|
-
}
|
|
4889
|
-
}
|
|
4890
|
-
return roles;
|
|
4891
|
-
}
|
|
4892
|
-
function createCell(props) {
|
|
4893
|
-
const { content, type } = props;
|
|
4894
|
-
if (content) {
|
|
4895
|
-
return type.createChecked(null, content);
|
|
4896
|
-
}
|
|
4897
|
-
return type.createAndFill();
|
|
4898
|
-
}
|
|
4899
|
-
function createTable(props) {
|
|
4900
|
-
const { schema, cellContent, columnsCount = 3, rowsCount = 3, withHeaderRow = true } = props;
|
|
4901
|
-
const {
|
|
4902
|
-
cell: tableCell,
|
|
4903
|
-
header_cell: tableHeaderCell,
|
|
4904
|
-
row: tableRow,
|
|
4905
|
-
table
|
|
4906
|
-
} = tableNodeTypes(schema);
|
|
4907
|
-
invariant(tableCell && tableHeaderCell && tableRow && table, {
|
|
4908
|
-
code: ErrorConstant.EXTENSION,
|
|
4909
|
-
message: "Table Extension unable to locate required nodes."
|
|
4910
|
-
});
|
|
4911
|
-
const cells = [];
|
|
4912
|
-
const headerCells = [];
|
|
4913
|
-
for (let ii = 0; ii < columnsCount; ii++) {
|
|
4914
|
-
cells.push(createCell({ type: tableCell, content: cellContent }));
|
|
4915
|
-
if (withHeaderRow) {
|
|
4916
|
-
headerCells.push(
|
|
4917
|
-
createCell({ type: tableHeaderCell, content: cellContent })
|
|
4918
|
-
);
|
|
4919
|
-
}
|
|
4920
|
-
}
|
|
4921
|
-
const rows = [];
|
|
4922
|
-
for (let ii = 0; ii < rowsCount; ii++) {
|
|
4923
|
-
const rowNodes = withHeaderRow && ii === 0 ? headerCells : cells;
|
|
4924
|
-
rows.push(tableRow.createChecked(null, rowNodes));
|
|
4925
|
-
}
|
|
4926
|
-
return table.createChecked(null, rows);
|
|
4927
|
-
}
|
|
4928
|
-
function findTable(selection) {
|
|
4929
|
-
return findParentNodeOfType({ selection, types: "table" });
|
|
4930
|
-
}
|
|
4931
|
-
function findCellClosestToPos(selection) {
|
|
4932
|
-
return findParentNodeOfType({ selection, types: ["tableHeaderCell", "tableCell"] });
|
|
4933
|
-
}
|
|
4934
|
-
var { CREATE_COMMAND_DESCRIPTION: CREATE_COMMAND_DESCRIPTION2, CREATE_COMMAND_LABEL: CREATE_COMMAND_LABEL2 } = extensionTablesMessages;
|
|
4935
|
-
var createTableOptions = {
|
|
4936
|
-
icon: "table2",
|
|
4937
|
-
description: ({ t }) => t(CREATE_COMMAND_DESCRIPTION2),
|
|
4938
|
-
label: ({ t }) => t(CREATE_COMMAND_LABEL2)
|
|
4939
|
-
};
|
|
4940
|
-
var tablesEnabled = false;
|
|
4941
|
-
var TableExtension = class extends NodeExtension {
|
|
4942
|
-
lastGoodState = void 0;
|
|
4943
|
-
get name() {
|
|
4944
|
-
return "table";
|
|
4945
|
-
}
|
|
4946
|
-
createTags() {
|
|
4947
|
-
return [ExtensionTag2.Block];
|
|
4948
|
-
}
|
|
4949
|
-
/**
|
|
4950
|
-
* The last known good state that didn't need fixing. This helps make the fix
|
|
4951
|
-
* command more effective.
|
|
4952
|
-
*/
|
|
4953
|
-
createNodeSpec(extra, override) {
|
|
4954
|
-
return createTableNodeSchema(extra, override).table;
|
|
4955
|
-
}
|
|
4956
|
-
/**
|
|
4957
|
-
* Create the table extensions. Set the priority to low so that they appear
|
|
4958
|
-
* lower down in the node list.
|
|
4959
|
-
*/
|
|
4960
|
-
createExtensions() {
|
|
4961
|
-
return [new TableRowExtension({ priority: ExtensionPriority.Low })];
|
|
4962
|
-
}
|
|
4963
|
-
onStateUpdate(props) {
|
|
4964
|
-
const { tr, state } = props;
|
|
4965
|
-
if (tr?.getMeta(fixTablesKey)?.fixTables) {
|
|
4966
|
-
this.lastGoodState = state;
|
|
4967
|
-
}
|
|
4968
|
-
}
|
|
4969
|
-
createEventHandlers() {
|
|
4970
|
-
return {
|
|
4971
|
-
editable: () => {
|
|
4972
|
-
this.store.updateExtensionPlugins(this);
|
|
4973
|
-
}
|
|
4974
|
-
};
|
|
4975
|
-
}
|
|
4976
|
-
/**
|
|
4977
|
-
* Add the table plugins to the editor.
|
|
4978
|
-
*/
|
|
4979
|
-
createExternalPlugins() {
|
|
4980
|
-
const plugins = [];
|
|
4981
|
-
if (this.store.isMounted() && this.store.helpers.isViewEditable() === false) {
|
|
4982
|
-
return plugins;
|
|
4983
|
-
}
|
|
4984
|
-
const { resizable, resizeableOptions } = this.options;
|
|
4985
|
-
if (resizable) {
|
|
4986
|
-
plugins.push(columnResizing(resizeableOptions));
|
|
4987
|
-
}
|
|
4988
|
-
plugins.push(tableEditing());
|
|
4989
|
-
return plugins;
|
|
4990
|
-
}
|
|
4991
|
-
createPlugin() {
|
|
4992
|
-
const { resizable, resizeableOptions } = this.options;
|
|
4993
|
-
if (!resizable) {
|
|
4994
|
-
return {};
|
|
4995
|
-
}
|
|
4996
|
-
if (!this.store.isMounted() || this.store.helpers.isViewEditable()) {
|
|
4997
|
-
return {};
|
|
4998
|
-
}
|
|
4999
|
-
const { cellMinWidth = 25 } = resizeableOptions;
|
|
5000
|
-
return {
|
|
5001
|
-
props: {
|
|
5002
|
-
nodeViews: {
|
|
5003
|
-
table(node, view, getPos) {
|
|
5004
|
-
const dom = view.nodeDOM(getPos());
|
|
5005
|
-
if (isElementDomNode(dom) && dom.tagName === "TABLE") {
|
|
5006
|
-
updateColumnsOnResize(
|
|
5007
|
-
node,
|
|
5008
|
-
dom.firstChild,
|
|
5009
|
-
dom,
|
|
5010
|
-
cellMinWidth
|
|
5011
|
-
);
|
|
5012
|
-
}
|
|
5013
|
-
return new TableView(node, cellMinWidth);
|
|
5014
|
-
}
|
|
5015
|
-
}
|
|
5016
|
-
}
|
|
5017
|
-
};
|
|
5018
|
-
}
|
|
5019
|
-
createTable(options = {}) {
|
|
5020
|
-
return (props) => {
|
|
5021
|
-
const { tr, dispatch, state } = props;
|
|
5022
|
-
if (!tr.selection.empty) {
|
|
5023
|
-
return false;
|
|
5024
|
-
}
|
|
5025
|
-
const offset = tr.selection.anchor + 1;
|
|
5026
|
-
const nodes = createTable({ schema: state.schema, ...options });
|
|
5027
|
-
dispatch?.(
|
|
5028
|
-
tr.replaceSelectionWith(nodes).scrollIntoView().setSelection(TextSelection.near(tr.doc.resolve(offset)))
|
|
5029
|
-
);
|
|
5030
|
-
return true;
|
|
5031
|
-
};
|
|
5032
|
-
}
|
|
5033
|
-
deleteTable() {
|
|
5034
|
-
return convertCommand(deleteTable);
|
|
5035
|
-
}
|
|
5036
|
-
addTableColumnBefore() {
|
|
5037
|
-
return convertCommand(addColumnBefore);
|
|
5038
|
-
}
|
|
5039
|
-
addTableColumnAfter() {
|
|
5040
|
-
return convertCommand(addColumnAfter);
|
|
5041
|
-
}
|
|
5042
|
-
deleteTableColumn() {
|
|
5043
|
-
return convertCommand(deleteColumn);
|
|
5044
|
-
}
|
|
5045
|
-
addTableRowBefore() {
|
|
5046
|
-
return convertCommand(addRowBefore);
|
|
5047
|
-
}
|
|
5048
|
-
addTableRowAfter() {
|
|
5049
|
-
return convertCommand(addRowAfter);
|
|
5050
|
-
}
|
|
5051
|
-
deleteTableRow() {
|
|
5052
|
-
return convertCommand(deleteRow);
|
|
5053
|
-
}
|
|
5054
|
-
toggleTableCellMerge() {
|
|
5055
|
-
return toggleMergeCellCommand;
|
|
5056
|
-
}
|
|
5057
|
-
mergeTableCells() {
|
|
5058
|
-
return convertCommand(mergeCells);
|
|
5059
|
-
}
|
|
5060
|
-
splitTableCell() {
|
|
5061
|
-
return convertCommand(splitCell);
|
|
5062
|
-
}
|
|
5063
|
-
toggleTableHeader(type = "row") {
|
|
5064
|
-
return convertCommand(toggleHeader(type));
|
|
5065
|
-
}
|
|
5066
|
-
toggleTableHeaderColumn() {
|
|
5067
|
-
return convertCommand(toggleHeaderColumn);
|
|
5068
|
-
}
|
|
5069
|
-
toggleTableHeaderRow() {
|
|
5070
|
-
return convertCommand(toggleHeaderRow);
|
|
5071
|
-
}
|
|
5072
|
-
toggleTableHeaderCell() {
|
|
5073
|
-
return convertCommand(toggleHeaderCell);
|
|
5074
|
-
}
|
|
5075
|
-
setTableCellAttribute(name, value) {
|
|
5076
|
-
return convertCommand(setCellAttr(name, value));
|
|
5077
|
-
}
|
|
5078
|
-
fixTables() {
|
|
5079
|
-
return nonChainable(fixTablesCommand(this.lastGoodState));
|
|
5080
|
-
}
|
|
5081
|
-
enableTableSupport() {
|
|
5082
|
-
if (!tablesEnabled) {
|
|
5083
|
-
document.execCommand("enableObjectResizing", false, "false");
|
|
5084
|
-
document.execCommand("enableInlineTableEditing", false, "false");
|
|
5085
|
-
tablesEnabled = true;
|
|
5086
|
-
}
|
|
5087
|
-
}
|
|
5088
|
-
tableHasHeader(type = "row", state = this.store.getState()) {
|
|
5089
|
-
const { selection } = state;
|
|
5090
|
-
const table = findParentNodeOfType2({ selection, types: "table" });
|
|
5091
|
-
if (!table) {
|
|
5092
|
-
return false;
|
|
5093
|
-
}
|
|
5094
|
-
const { node } = table;
|
|
5095
|
-
const map = TableMap.get(node);
|
|
5096
|
-
const isHeaderFunc = type === "column" ? columnIsHeader : rowIsHeader;
|
|
5097
|
-
return isHeaderFunc(map, node, 0);
|
|
5098
|
-
}
|
|
5099
|
-
setTableCellBackground(background) {
|
|
5100
|
-
return (props) => {
|
|
5101
|
-
let { tr } = props;
|
|
5102
|
-
const { dispatch } = props;
|
|
5103
|
-
const { selection } = tr;
|
|
5104
|
-
if (selection instanceof CellSelection) {
|
|
5105
|
-
selection.forEachCell((cellNode, pos) => {
|
|
5106
|
-
tr = tr.setNodeMarkup(pos, void 0, { ...cellNode.attrs, background });
|
|
5107
|
-
});
|
|
5108
|
-
dispatch?.(tr);
|
|
5109
|
-
return true;
|
|
5110
|
-
}
|
|
5111
|
-
const found = findParentNodeOfType2({ selection, types: ["tableCell", "tableHeaderCell"] });
|
|
5112
|
-
if (found) {
|
|
5113
|
-
dispatch?.(tr.setNodeMarkup(found.pos, void 0, { ...found.node.attrs, background }));
|
|
5114
|
-
return true;
|
|
5115
|
-
}
|
|
5116
|
-
return false;
|
|
5117
|
-
};
|
|
5118
|
-
}
|
|
5119
|
-
selectParentCell() {
|
|
5120
|
-
return ({ dispatch, tr }) => {
|
|
5121
|
-
const cell = findCellClosestToPos(tr.selection.$from);
|
|
5122
|
-
if (!cell) {
|
|
5123
|
-
return false;
|
|
5124
|
-
}
|
|
5125
|
-
dispatch?.(tr.setSelection(CellSelection.create(tr.doc, cell.pos)));
|
|
5126
|
-
return true;
|
|
5127
|
-
};
|
|
5128
|
-
}
|
|
5129
|
-
expandCellSelection(type = "all") {
|
|
5130
|
-
return ({ dispatch, tr }) => {
|
|
5131
|
-
if (!isCellSelection(tr.selection)) {
|
|
5132
|
-
return false;
|
|
5133
|
-
}
|
|
5134
|
-
if (type !== "row") {
|
|
5135
|
-
const { $anchorCell, $headCell } = tr.selection;
|
|
5136
|
-
tr.setSelection(CellSelection.colSelection($anchorCell, $headCell));
|
|
5137
|
-
}
|
|
5138
|
-
if (type !== "column") {
|
|
5139
|
-
const { $anchorCell, $headCell } = tr.selection;
|
|
5140
|
-
tr.setSelection(CellSelection.rowSelection($anchorCell, $headCell));
|
|
5141
|
-
}
|
|
5142
|
-
dispatch?.(tr);
|
|
5143
|
-
return true;
|
|
5144
|
-
};
|
|
5145
|
-
}
|
|
5146
|
-
goToNextCell(props) {
|
|
5147
|
-
return convertCommand(goToNextCell(1))(props);
|
|
5148
|
-
}
|
|
5149
|
-
goToPreviousCell(props) {
|
|
5150
|
-
return convertCommand(goToNextCell(-1))(props);
|
|
5151
|
-
}
|
|
5152
|
-
/**
|
|
5153
|
-
* This managers the updates of the collaboration provider.
|
|
5154
|
-
*/
|
|
5155
|
-
onSetOptions(props) {
|
|
5156
|
-
const { changes } = props;
|
|
5157
|
-
if (changes.resizable.changed) {
|
|
5158
|
-
this.store.updateExtensionPlugins(this);
|
|
5159
|
-
}
|
|
5160
|
-
}
|
|
5161
|
-
};
|
|
5162
|
-
__decorateClass2([
|
|
5163
|
-
command(createTableOptions)
|
|
5164
|
-
], TableExtension.prototype, "createTable", 1);
|
|
5165
|
-
__decorateClass2([
|
|
5166
|
-
command()
|
|
5167
|
-
], TableExtension.prototype, "deleteTable", 1);
|
|
5168
|
-
__decorateClass2([
|
|
5169
|
-
command()
|
|
5170
|
-
], TableExtension.prototype, "addTableColumnBefore", 1);
|
|
5171
|
-
__decorateClass2([
|
|
5172
|
-
command()
|
|
5173
|
-
], TableExtension.prototype, "addTableColumnAfter", 1);
|
|
5174
|
-
__decorateClass2([
|
|
5175
|
-
command()
|
|
5176
|
-
], TableExtension.prototype, "deleteTableColumn", 1);
|
|
5177
|
-
__decorateClass2([
|
|
5178
|
-
command()
|
|
5179
|
-
], TableExtension.prototype, "addTableRowBefore", 1);
|
|
5180
|
-
__decorateClass2([
|
|
5181
|
-
command()
|
|
5182
|
-
], TableExtension.prototype, "addTableRowAfter", 1);
|
|
5183
|
-
__decorateClass2([
|
|
5184
|
-
command()
|
|
5185
|
-
], TableExtension.prototype, "deleteTableRow", 1);
|
|
5186
|
-
__decorateClass2([
|
|
5187
|
-
command()
|
|
5188
|
-
], TableExtension.prototype, "toggleTableCellMerge", 1);
|
|
5189
|
-
__decorateClass2([
|
|
5190
|
-
command()
|
|
5191
|
-
], TableExtension.prototype, "mergeTableCells", 1);
|
|
5192
|
-
__decorateClass2([
|
|
5193
|
-
command()
|
|
5194
|
-
], TableExtension.prototype, "splitTableCell", 1);
|
|
5195
|
-
__decorateClass2([
|
|
5196
|
-
command()
|
|
5197
|
-
], TableExtension.prototype, "toggleTableHeader", 1);
|
|
5198
|
-
__decorateClass2([
|
|
5199
|
-
command()
|
|
5200
|
-
], TableExtension.prototype, "toggleTableHeaderColumn", 1);
|
|
5201
|
-
__decorateClass2([
|
|
5202
|
-
command()
|
|
5203
|
-
], TableExtension.prototype, "toggleTableHeaderRow", 1);
|
|
5204
|
-
__decorateClass2([
|
|
5205
|
-
command()
|
|
5206
|
-
], TableExtension.prototype, "toggleTableHeaderCell", 1);
|
|
5207
|
-
__decorateClass2([
|
|
5208
|
-
command()
|
|
5209
|
-
], TableExtension.prototype, "setTableCellAttribute", 1);
|
|
5210
|
-
__decorateClass2([
|
|
5211
|
-
command({ disableChaining: true })
|
|
5212
|
-
], TableExtension.prototype, "fixTables", 1);
|
|
5213
|
-
__decorateClass2([
|
|
5214
|
-
helper()
|
|
5215
|
-
], TableExtension.prototype, "enableTableSupport", 1);
|
|
5216
|
-
__decorateClass2([
|
|
5217
|
-
helper()
|
|
5218
|
-
], TableExtension.prototype, "tableHasHeader", 1);
|
|
5219
|
-
__decorateClass2([
|
|
5220
|
-
command()
|
|
5221
|
-
], TableExtension.prototype, "setTableCellBackground", 1);
|
|
5222
|
-
__decorateClass2([
|
|
5223
|
-
command()
|
|
5224
|
-
], TableExtension.prototype, "selectParentCell", 1);
|
|
5225
|
-
__decorateClass2([
|
|
5226
|
-
command()
|
|
5227
|
-
], TableExtension.prototype, "expandCellSelection", 1);
|
|
5228
|
-
__decorateClass2([
|
|
5229
|
-
keyBinding({
|
|
5230
|
-
shortcut: "Tab",
|
|
5231
|
-
isActive: (options) => options.tabKeyboardShortcuts
|
|
5232
|
-
})
|
|
5233
|
-
], TableExtension.prototype, "goToNextCell", 1);
|
|
5234
|
-
__decorateClass2([
|
|
5235
|
-
keyBinding({
|
|
5236
|
-
shortcut: "Shift-Tab",
|
|
5237
|
-
isActive: (options) => options.tabKeyboardShortcuts
|
|
5238
|
-
})
|
|
5239
|
-
], TableExtension.prototype, "goToPreviousCell", 1);
|
|
5240
|
-
TableExtension = __decorateClass2([
|
|
5241
|
-
extension({
|
|
5242
|
-
defaultOptions: {
|
|
5243
|
-
resizable: true,
|
|
5244
|
-
resizeableOptions: {},
|
|
5245
|
-
tabKeyboardShortcuts: false
|
|
5246
|
-
},
|
|
5247
|
-
defaultPriority: ExtensionPriority.Default
|
|
5248
|
-
})
|
|
5249
|
-
], TableExtension);
|
|
5250
|
-
var TableRowExtension = class extends NodeExtension {
|
|
5251
|
-
get name() {
|
|
5252
|
-
return "tableRow";
|
|
5253
|
-
}
|
|
5254
|
-
/**
|
|
5255
|
-
* Automatically create the `TableCellExtension` and
|
|
5256
|
-
* `TableHeaderCellExtension`. This is placed here so that this extension can
|
|
5257
|
-
* be tested independently from the `TableExtension`.
|
|
5258
|
-
*/
|
|
5259
|
-
createExtensions() {
|
|
5260
|
-
return [
|
|
5261
|
-
new TableCellExtension({ priority: ExtensionPriority.Low }),
|
|
5262
|
-
new TableHeaderCellExtension({ priority: ExtensionPriority.Low })
|
|
5263
|
-
];
|
|
5264
|
-
}
|
|
5265
|
-
createNodeSpec(extra, override) {
|
|
5266
|
-
return createTableNodeSchema(extra, override).tableRow;
|
|
5267
|
-
}
|
|
5268
|
-
};
|
|
5269
|
-
TableRowExtension = __decorateClass2([
|
|
5270
|
-
extension({ defaultPriority: ExtensionPriority.Low })
|
|
5271
|
-
], TableRowExtension);
|
|
5272
|
-
var TableCellExtension = class extends NodeExtension {
|
|
5273
|
-
get name() {
|
|
5274
|
-
return "tableCell";
|
|
5275
|
-
}
|
|
5276
|
-
createNodeSpec(extra, override) {
|
|
5277
|
-
return createTableNodeSchema(extra, override).tableCell;
|
|
5278
|
-
}
|
|
5279
|
-
};
|
|
5280
|
-
TableCellExtension = __decorateClass2([
|
|
5281
|
-
extension({ defaultPriority: ExtensionPriority.Low })
|
|
5282
|
-
], TableCellExtension);
|
|
5283
|
-
var TableHeaderCellExtension = class extends NodeExtension {
|
|
5284
|
-
get name() {
|
|
5285
|
-
return "tableHeaderCell";
|
|
5286
|
-
}
|
|
5287
|
-
createNodeSpec(extra, override) {
|
|
5288
|
-
return createTableNodeSchema(extra, override).tableHeaderCell;
|
|
5289
|
-
}
|
|
5290
|
-
};
|
|
5291
|
-
TableHeaderCellExtension = __decorateClass2([
|
|
5292
|
-
extension({ defaultPriority: ExtensionPriority.Low })
|
|
5293
|
-
], TableHeaderCellExtension);
|
|
5294
|
-
var TableControllerCellExtension = class extends NodeExtension {
|
|
5295
|
-
get name() {
|
|
5296
|
-
return "tableControllerCell";
|
|
5297
|
-
}
|
|
5298
|
-
createNodeSpec(_, __) {
|
|
5299
|
-
return {
|
|
5300
|
-
tableRole: "header_cell"
|
|
5301
|
-
};
|
|
5302
|
-
}
|
|
5303
|
-
};
|
|
5304
|
-
TableControllerCellExtension = __decorateClass2([
|
|
5305
|
-
extension({ defaultPriority: ExtensionPriority.Low })
|
|
5306
|
-
], TableControllerCellExtension);
|
|
5307
|
-
function fixTablesCommand(lastGoodState) {
|
|
5308
|
-
return ({ state, dispatch }) => {
|
|
5309
|
-
const tr = fixTables(state, lastGoodState);
|
|
5310
|
-
if (!tr) {
|
|
5311
|
-
return false;
|
|
5312
|
-
}
|
|
5313
|
-
if (dispatch) {
|
|
5314
|
-
dispatch(tr);
|
|
5315
|
-
}
|
|
5316
|
-
return true;
|
|
5317
|
-
};
|
|
5318
|
-
}
|
|
5319
|
-
function toggleMergeCellCommand({ state, dispatch }) {
|
|
5320
|
-
if (mergeCells(state, dispatch)) {
|
|
5321
|
-
return false;
|
|
5322
|
-
}
|
|
5323
|
-
return splitCell(state, dispatch);
|
|
5324
|
-
}
|
|
5325
|
-
function getCellsInColumn(selection, columnIndex) {
|
|
5326
|
-
const table = findTable(selection);
|
|
5327
|
-
if (!table) {
|
|
5328
|
-
return;
|
|
5329
|
-
}
|
|
5330
|
-
const map = TableMap2.get(table.node);
|
|
5331
|
-
if (columnIndex > 0 || columnIndex > map.width - 1) {
|
|
5332
|
-
return;
|
|
5333
|
-
}
|
|
5334
|
-
const cells = map.cellsInRect({
|
|
5335
|
-
left: columnIndex,
|
|
5336
|
-
right: columnIndex + 1,
|
|
5337
|
-
top: 0,
|
|
5338
|
-
bottom: map.height
|
|
5339
|
-
});
|
|
5340
|
-
const columnNodes = [];
|
|
5341
|
-
cells.forEach((nodePos) => {
|
|
5342
|
-
columnNodes.push({
|
|
5343
|
-
node: table.node.nodeAt(nodePos),
|
|
5344
|
-
pos: table.start + nodePos
|
|
5345
|
-
});
|
|
5346
|
-
});
|
|
5347
|
-
return columnNodes;
|
|
5348
|
-
}
|
|
5349
|
-
function getCellsInRow(selection, rowIndex) {
|
|
5350
|
-
const table = findTable(selection);
|
|
5351
|
-
if (!table) {
|
|
5352
|
-
return;
|
|
5353
|
-
}
|
|
5354
|
-
const map = TableMap2.get(table.node);
|
|
5355
|
-
if (rowIndex > 0 || rowIndex > map.width - 1) {
|
|
5356
|
-
return;
|
|
5357
|
-
}
|
|
5358
|
-
const cells = map.cellsInRect({
|
|
5359
|
-
left: 0,
|
|
5360
|
-
right: map.width,
|
|
5361
|
-
top: rowIndex,
|
|
5362
|
-
bottom: rowIndex + 1
|
|
5363
|
-
});
|
|
5364
|
-
const columnNodes = [];
|
|
5365
|
-
cells.forEach((nodePos) => {
|
|
5366
|
-
columnNodes.push({
|
|
5367
|
-
node: table.node.nodeAt(nodePos),
|
|
5368
|
-
pos: table.start + nodePos
|
|
5369
|
-
});
|
|
5370
|
-
});
|
|
5371
|
-
return columnNodes;
|
|
5372
|
-
}
|
|
5373
|
-
var tablePositioner = Positioner.create({
|
|
5374
|
-
hasChanged: hasStateChanged,
|
|
5375
|
-
getActive(props) {
|
|
5376
|
-
const { selection } = props.state;
|
|
5377
|
-
const table = findTable(selection);
|
|
5378
|
-
if (!table) {
|
|
5379
|
-
return Positioner.EMPTY;
|
|
5380
|
-
}
|
|
5381
|
-
return [table];
|
|
5382
|
-
},
|
|
5383
|
-
getPosition(props) {
|
|
5384
|
-
const { view, data: table } = props;
|
|
5385
|
-
const node = view.nodeDOM(table.pos);
|
|
5386
|
-
if (!isElementDomNode2(node)) {
|
|
5387
|
-
return defaultAbsolutePosition;
|
|
5388
|
-
}
|
|
5389
|
-
const rect = node.getBoundingClientRect();
|
|
5390
|
-
const editorRect = view.dom.getBoundingClientRect();
|
|
5391
|
-
const height = rect.height;
|
|
5392
|
-
const width = rect.width;
|
|
5393
|
-
const left = view.dom.scrollLeft + rect.left - editorRect.left - 1;
|
|
5394
|
-
const top = view.dom.scrollTop + rect.top - editorRect.top - 1;
|
|
5395
|
-
return {
|
|
5396
|
-
x: left,
|
|
5397
|
-
y: top,
|
|
5398
|
-
height,
|
|
5399
|
-
width,
|
|
5400
|
-
rect,
|
|
5401
|
-
visible: isPositionVisible(rect, view.dom)
|
|
5402
|
-
};
|
|
5403
|
-
}
|
|
5404
|
-
});
|
|
5405
|
-
var activeCellPositioner = tablePositioner.clone(() => ({
|
|
5406
|
-
getActive(props) {
|
|
5407
|
-
const { selection } = props.state;
|
|
5408
|
-
const cell = findCellClosestToPos(selection);
|
|
5409
|
-
if (!cell) {
|
|
5410
|
-
return Positioner.EMPTY;
|
|
5411
|
-
}
|
|
5412
|
-
return [cell];
|
|
5413
|
-
}
|
|
5414
|
-
}));
|
|
5415
|
-
var allColumnsStartPositioner = Positioner.create({
|
|
5416
|
-
hasChanged: hasStateChanged,
|
|
5417
|
-
getActive(props) {
|
|
5418
|
-
const { selection } = props.state;
|
|
5419
|
-
const table = findTable(selection);
|
|
5420
|
-
if (!table) {
|
|
5421
|
-
return Positioner.EMPTY;
|
|
5422
|
-
}
|
|
5423
|
-
const cells = getCellsInRow(selection, 0) ?? [];
|
|
5424
|
-
if (cells.length === 0) {
|
|
5425
|
-
return Positioner.EMPTY;
|
|
5426
|
-
}
|
|
5427
|
-
return cells;
|
|
5428
|
-
},
|
|
5429
|
-
getID(data) {
|
|
5430
|
-
return `${data.pos}`;
|
|
5431
|
-
},
|
|
5432
|
-
getPosition(props) {
|
|
5433
|
-
const { view, data: cell } = props;
|
|
5434
|
-
const node = view.nodeDOM(cell.pos);
|
|
5435
|
-
if (!isElementDomNode2(node)) {
|
|
5436
|
-
return defaultAbsolutePosition;
|
|
5437
|
-
}
|
|
5438
|
-
const rect = node.getBoundingClientRect();
|
|
5439
|
-
const editorRect = view.dom.getBoundingClientRect();
|
|
5440
|
-
const width = rect.width;
|
|
5441
|
-
const left = view.dom.scrollLeft + rect.left - editorRect.left - 1;
|
|
5442
|
-
const top = view.dom.scrollTop + rect.top - editorRect.top - 1;
|
|
5443
|
-
const columnTopRect = new DOMRect(rect.x - 1, rect.y - 1, width, 1);
|
|
5444
|
-
return {
|
|
5445
|
-
x: left,
|
|
5446
|
-
y: top,
|
|
5447
|
-
width,
|
|
5448
|
-
height: 1,
|
|
5449
|
-
rect: columnTopRect,
|
|
5450
|
-
visible: isPositionVisible(columnTopRect, view.dom)
|
|
5451
|
-
};
|
|
5452
|
-
}
|
|
5453
|
-
});
|
|
5454
|
-
var allRowsStartPositioner = allColumnsStartPositioner.clone(() => ({
|
|
5455
|
-
/**
|
|
5456
|
-
* This is only active for empty top level nodes. The data is the cursor start
|
|
5457
|
-
* and end position.
|
|
5458
|
-
*/
|
|
5459
|
-
getActive(props) {
|
|
5460
|
-
const { selection } = props.state;
|
|
5461
|
-
const table = findTable(selection);
|
|
5462
|
-
if (!table) {
|
|
5463
|
-
return Positioner.EMPTY;
|
|
5464
|
-
}
|
|
5465
|
-
const cells = getCellsInColumn(selection, 0) ?? [];
|
|
5466
|
-
if (cells.length === 0) {
|
|
5467
|
-
return Positioner.EMPTY;
|
|
5468
|
-
}
|
|
5469
|
-
return cells;
|
|
5470
|
-
},
|
|
5471
|
-
getPosition(props) {
|
|
5472
|
-
const { view, data: cell } = props;
|
|
5473
|
-
const node = view.nodeDOM(cell.pos);
|
|
5474
|
-
if (!isElementDomNode2(node)) {
|
|
5475
|
-
return defaultAbsolutePosition;
|
|
5476
|
-
}
|
|
5477
|
-
const rect = node.getBoundingClientRect();
|
|
5478
|
-
const editorRect = view.dom.getBoundingClientRect();
|
|
5479
|
-
const height = rect.height;
|
|
5480
|
-
const left = view.dom.scrollLeft + rect.left - editorRect.left - 1;
|
|
5481
|
-
const top = view.dom.scrollTop + rect.top - editorRect.top - 1;
|
|
5482
|
-
const rowLeftRect = new DOMRect(rect.x - 1, rect.y - 1, 1, height);
|
|
5483
|
-
return {
|
|
5484
|
-
x: left,
|
|
5485
|
-
y: top,
|
|
5486
|
-
width: 1,
|
|
5487
|
-
height,
|
|
5488
|
-
rect: rowLeftRect,
|
|
5489
|
-
visible: isPositionVisible(rowLeftRect, view.dom)
|
|
5490
|
-
};
|
|
5491
|
-
}
|
|
5492
|
-
}));
|
|
5493
|
-
var activeCellColumnPositioner = Positioner.create({
|
|
5494
|
-
hasChanged: hasStateChanged,
|
|
5495
|
-
getActive(props) {
|
|
5496
|
-
const { state, view } = props;
|
|
5497
|
-
const { selection } = state;
|
|
5498
|
-
const table = findTable(selection);
|
|
5499
|
-
if (!table) {
|
|
5500
|
-
return Positioner.EMPTY;
|
|
5501
|
-
}
|
|
5502
|
-
const cell = findCellClosestToPos(selection);
|
|
5503
|
-
if (!cell) {
|
|
5504
|
-
return Positioner.EMPTY;
|
|
5505
|
-
}
|
|
5506
|
-
const { pos } = cell;
|
|
5507
|
-
const tableNode = view.nodeDOM(table.pos);
|
|
5508
|
-
const node = view.nodeDOM(pos);
|
|
5509
|
-
if (!isElementDomNode2(tableNode) || !isElementDomNode2(node)) {
|
|
5510
|
-
return Positioner.EMPTY;
|
|
5511
|
-
}
|
|
5512
|
-
const tableRect = tableNode.getBoundingClientRect();
|
|
5513
|
-
const rect = node.getBoundingClientRect();
|
|
5514
|
-
return [
|
|
5515
|
-
{
|
|
5516
|
-
pos,
|
|
5517
|
-
rect: new DOMRect(rect.x, tableRect.y, rect.width, tableRect.height)
|
|
5518
|
-
}
|
|
5519
|
-
];
|
|
5520
|
-
},
|
|
5521
|
-
getID({ pos }) {
|
|
5522
|
-
return `${pos}`;
|
|
5523
|
-
},
|
|
5524
|
-
getPosition(props) {
|
|
5525
|
-
const {
|
|
5526
|
-
view,
|
|
5527
|
-
data: { rect }
|
|
5528
|
-
} = props;
|
|
5529
|
-
const editorRect = view.dom.getBoundingClientRect();
|
|
5530
|
-
const height = rect.height;
|
|
5531
|
-
const width = rect.width;
|
|
5532
|
-
const left = view.dom.scrollLeft + rect.left - editorRect.left - 1;
|
|
5533
|
-
const top = view.dom.scrollTop + rect.top - editorRect.top - 1;
|
|
5534
|
-
return {
|
|
5535
|
-
x: left,
|
|
5536
|
-
y: top,
|
|
5537
|
-
width,
|
|
5538
|
-
height,
|
|
5539
|
-
rect,
|
|
5540
|
-
visible: isPositionVisible(rect, view.dom)
|
|
5541
|
-
};
|
|
5542
|
-
}
|
|
5543
|
-
});
|
|
5544
|
-
var activeCellRowPositioner = activeCellColumnPositioner.clone(() => ({
|
|
5545
|
-
getActive(props) {
|
|
5546
|
-
const { state, view } = props;
|
|
5547
|
-
const { selection } = state;
|
|
5548
|
-
const table = findTable(selection);
|
|
5549
|
-
if (!table) {
|
|
5550
|
-
return Positioner.EMPTY;
|
|
5551
|
-
}
|
|
5552
|
-
const cell = findCellClosestToPos(selection);
|
|
5553
|
-
if (!cell) {
|
|
5554
|
-
return Positioner.EMPTY;
|
|
5555
|
-
}
|
|
5556
|
-
const { pos } = cell;
|
|
5557
|
-
const tableNode = view.nodeDOM(table.pos);
|
|
5558
|
-
const node = view.nodeDOM(pos);
|
|
5559
|
-
if (!isElementDomNode2(tableNode) || !isElementDomNode2(node)) {
|
|
5560
|
-
return Positioner.EMPTY;
|
|
5561
|
-
}
|
|
5562
|
-
const tableRect = tableNode.getBoundingClientRect();
|
|
5563
|
-
const rect = node.getBoundingClientRect();
|
|
5564
|
-
return [
|
|
5565
|
-
{
|
|
5566
|
-
pos,
|
|
5567
|
-
rect: new DOMRect(tableRect.x, rect.y, tableRect.width, rect.height)
|
|
5568
|
-
}
|
|
5569
|
-
];
|
|
5570
|
-
}
|
|
5571
|
-
}));
|
|
5572
|
-
var selectedColumnPositioner = activeCellColumnPositioner.clone(({ getActive }) => ({
|
|
5573
|
-
getActive(props) {
|
|
5574
|
-
const [data] = getActive(props);
|
|
5575
|
-
if (!data) {
|
|
5576
|
-
return Positioner.EMPTY;
|
|
5577
|
-
}
|
|
5578
|
-
const { selection } = props.state;
|
|
5579
|
-
if (!isCellSelection2(selection) || !selection.isColSelection()) {
|
|
5580
|
-
return Positioner.EMPTY;
|
|
5581
|
-
}
|
|
5582
|
-
const table = findTable(selection);
|
|
5583
|
-
if (!table) {
|
|
5584
|
-
return Positioner.EMPTY;
|
|
5585
|
-
}
|
|
5586
|
-
const { node, start } = table;
|
|
5587
|
-
const { $anchorCell, $headCell } = selection;
|
|
5588
|
-
const map = TableMap2.get(node);
|
|
5589
|
-
const rect = map.rectBetween($anchorCell.pos - start, $headCell.pos - start);
|
|
5590
|
-
if (rect.right - rect.left !== 1) {
|
|
5591
|
-
return Positioner.EMPTY;
|
|
5592
|
-
}
|
|
5593
|
-
return [data];
|
|
5594
|
-
}
|
|
5595
|
-
}));
|
|
5596
|
-
var selectedRowPositioner = activeCellRowPositioner.clone(({ getActive }) => ({
|
|
5597
|
-
getActive(props) {
|
|
5598
|
-
const [data] = getActive(props);
|
|
5599
|
-
if (!data) {
|
|
5600
|
-
return Positioner.EMPTY;
|
|
5601
|
-
}
|
|
5602
|
-
const { selection } = props.state;
|
|
5603
|
-
if (!isCellSelection2(selection) || !selection.isRowSelection()) {
|
|
5604
|
-
return Positioner.EMPTY;
|
|
5605
|
-
}
|
|
5606
|
-
const table = findTable(selection);
|
|
5607
|
-
if (!table) {
|
|
5608
|
-
return Positioner.EMPTY;
|
|
5609
|
-
}
|
|
5610
|
-
const { node, start } = table;
|
|
5611
|
-
const { $anchorCell, $headCell } = selection;
|
|
5612
|
-
const map = TableMap2.get(node);
|
|
5613
|
-
const rect = map.rectBetween($anchorCell.pos - start, $headCell.pos - start);
|
|
5614
|
-
if (rect.bottom - rect.top !== 1) {
|
|
5615
|
-
return Positioner.EMPTY;
|
|
5616
|
-
}
|
|
5617
|
-
return [data];
|
|
5618
|
-
}
|
|
5619
|
-
}));
|
|
5620
|
-
var cellSelectionPositioner = Positioner.create({
|
|
5621
|
-
hasChanged: hasStateChanged,
|
|
5622
|
-
getActive(props) {
|
|
5623
|
-
const { selection } = props.state;
|
|
5624
|
-
if (!isCellSelection2(selection)) {
|
|
5625
|
-
return Positioner.EMPTY;
|
|
5626
|
-
}
|
|
5627
|
-
return [selection];
|
|
5628
|
-
},
|
|
5629
|
-
getPosition(props) {
|
|
5630
|
-
const { view, data: selection } = props;
|
|
5631
|
-
const { $headCell, $anchorCell } = selection;
|
|
5632
|
-
const headNode = view.nodeDOM($headCell.pos);
|
|
5633
|
-
const anchorNode = view.nodeDOM($anchorCell.pos);
|
|
5634
|
-
if (!isElementDomNode2(headNode) || !isElementDomNode2(anchorNode)) {
|
|
5635
|
-
return defaultAbsolutePosition;
|
|
5636
|
-
}
|
|
5637
|
-
const rect = mergeDOMRects(
|
|
5638
|
-
headNode.getBoundingClientRect(),
|
|
5639
|
-
anchorNode.getBoundingClientRect()
|
|
5640
|
-
);
|
|
5641
|
-
const editorRect = view.dom.getBoundingClientRect();
|
|
5642
|
-
const height = rect.height;
|
|
5643
|
-
const width = rect.width;
|
|
5644
|
-
const left = view.dom.scrollLeft + rect.left - editorRect.left - 1;
|
|
5645
|
-
const top = view.dom.scrollTop + rect.top - editorRect.top - 1;
|
|
5646
|
-
return {
|
|
5647
|
-
x: left,
|
|
5648
|
-
y: top,
|
|
5649
|
-
width,
|
|
5650
|
-
height,
|
|
5651
|
-
rect,
|
|
5652
|
-
visible: isPositionVisible(rect, view.dom)
|
|
5653
|
-
};
|
|
5654
|
-
}
|
|
5655
|
-
});
|
|
5656
|
-
var cellColumnSelectionPositioner = cellSelectionPositioner.clone(({ getActive }) => ({
|
|
5657
|
-
getActive(props) {
|
|
5658
|
-
const [selection] = getActive(props);
|
|
5659
|
-
if (!selection?.isColSelection()) {
|
|
5660
|
-
return Positioner.EMPTY;
|
|
5661
|
-
}
|
|
5662
|
-
return [selection];
|
|
5663
|
-
}
|
|
5664
|
-
}));
|
|
5665
|
-
var cellRowSelectionPositioner = cellSelectionPositioner.clone(({ getActive }) => ({
|
|
5666
|
-
getActive(props) {
|
|
5667
|
-
const [selection] = getActive(props);
|
|
5668
|
-
if (!selection?.isRowSelection()) {
|
|
5669
|
-
return Positioner.EMPTY;
|
|
5670
|
-
}
|
|
5671
|
-
return [selection];
|
|
5672
|
-
}
|
|
5673
|
-
}));
|
|
5674
|
-
var allCellSelectionPositioner = cellSelectionPositioner.clone(({ getActive }) => ({
|
|
5675
|
-
getActive(props) {
|
|
5676
|
-
const [selection] = getActive(props);
|
|
5677
|
-
if (!selection?.isColSelection() || !selection.isRowSelection()) {
|
|
5678
|
-
return Positioner.EMPTY;
|
|
5679
|
-
}
|
|
5680
|
-
return [selection];
|
|
5681
|
-
}
|
|
5682
|
-
}));
|
|
5683
|
-
|
|
5684
4666
|
// src/extensions/Table/table-extension.ts
|
|
5685
|
-
import {
|
|
4667
|
+
import {
|
|
4668
|
+
TableCellExtension,
|
|
4669
|
+
TableExtension,
|
|
4670
|
+
TableHeaderCellExtension,
|
|
4671
|
+
TableRowExtension
|
|
4672
|
+
} from "@remirror/extension-tables";
|
|
4673
|
+
import { TextSelection } from "@remirror/pm/state";
|
|
5686
4674
|
|
|
5687
4675
|
// src/utils/build-block-enter-keymap.ts
|
|
5688
|
-
import { convertCommand
|
|
4676
|
+
import { convertCommand, isTextSelection } from "@remirror/core";
|
|
5689
4677
|
import { Fragment } from "@remirror/pm/model";
|
|
5690
4678
|
function buildBlockEnterKeymap(regex, getNode, transact) {
|
|
5691
4679
|
return {
|
|
5692
|
-
Enter:
|
|
4680
|
+
Enter: convertCommand((state, dispatch) => {
|
|
5693
4681
|
if (!isTextSelection(state.selection))
|
|
5694
4682
|
return false;
|
|
5695
4683
|
const $cursor = state.selection.$cursor;
|
|
@@ -5725,7 +4713,7 @@ function buildBlockEnterKeymap(regex, getNode, transact) {
|
|
|
5725
4713
|
}
|
|
5726
4714
|
|
|
5727
4715
|
// src/extensions/Table/table-extension.ts
|
|
5728
|
-
import { CellSelection
|
|
4716
|
+
import { CellSelection } from "@remirror/pm/tables";
|
|
5729
4717
|
var LineTableExtension = class extends TableExtension {
|
|
5730
4718
|
constructor() {
|
|
5731
4719
|
super(...arguments);
|
|
@@ -5755,7 +4743,7 @@ var LineTableExtension = class extends TableExtension {
|
|
|
5755
4743
|
const depth = $cursor.depth - 1;
|
|
5756
4744
|
const pos = $cursor.posAtIndex($cursor.index(depth) - 1, depth);
|
|
5757
4745
|
const $pos = tr.doc.resolve(pos);
|
|
5758
|
-
return tr.setSelection(
|
|
4746
|
+
return tr.setSelection(TextSelection.near($pos));
|
|
5759
4747
|
}
|
|
5760
4748
|
}
|
|
5761
4749
|
);
|
|
@@ -5895,7 +4883,7 @@ var LineTableCellExtension = class extends TableCellExtension {
|
|
|
5895
4883
|
return {
|
|
5896
4884
|
selectTableCell: ({ pos }) => {
|
|
5897
4885
|
return ({ tr, dispatch }) => {
|
|
5898
|
-
if (tr.setSelection(
|
|
4886
|
+
if (tr.setSelection(CellSelection.create(tr.doc, pos))) {
|
|
5899
4887
|
dispatch?.(tr);
|
|
5900
4888
|
return true;
|
|
5901
4889
|
}
|
|
@@ -5938,7 +4926,7 @@ import { isTextSelection as isTextSelection2, PlainExtension } from "@remirror/c
|
|
|
5938
4926
|
import { Decoration, DecorationSet } from "@remirror/pm/view";
|
|
5939
4927
|
|
|
5940
4928
|
// src/extensions/Inline/inline-mark-extensions.ts
|
|
5941
|
-
import { MarkExtension as MarkExtension2, extension as
|
|
4929
|
+
import { MarkExtension as MarkExtension2, extension as extension2, keyBinding } from "@remirror/core";
|
|
5942
4930
|
|
|
5943
4931
|
// src/extensions/Inline/format-href.ts
|
|
5944
4932
|
function formatHref(location2) {
|
|
@@ -5964,7 +4952,7 @@ function formatFileUrl(filePath) {
|
|
|
5964
4952
|
}
|
|
5965
4953
|
|
|
5966
4954
|
// src/extensions/Inline/inline-mark-commands.ts
|
|
5967
|
-
import { TextSelection as
|
|
4955
|
+
import { TextSelection as TextSelection2 } from "@remirror/pm/state";
|
|
5968
4956
|
|
|
5969
4957
|
// src/extensions/Inline/inline-mark-helpers.ts
|
|
5970
4958
|
import { Transform } from "@remirror/pm/transform";
|
|
@@ -6741,7 +5729,7 @@ function addSimpleInlineMark({ left, right }) {
|
|
|
6741
5729
|
tr.insertText(right, $to.pos);
|
|
6742
5730
|
tr.insertText(left, $from.pos);
|
|
6743
5731
|
const offset = left.length;
|
|
6744
|
-
tr.setSelection(
|
|
5732
|
+
tr.setSelection(TextSelection2.create(tr.doc, anchor + offset, head + offset));
|
|
6745
5733
|
updateRangeMarks(tr);
|
|
6746
5734
|
dispatch(tr);
|
|
6747
5735
|
}
|
|
@@ -6799,7 +5787,7 @@ function deleteTextBlockChild(tr, textBlockNode, textBlockStart, childIndex) {
|
|
|
6799
5787
|
}
|
|
6800
5788
|
|
|
6801
5789
|
// src/extensions/HtmlNode/html-inline-extension.ts
|
|
6802
|
-
import { MarkExtension, extension
|
|
5790
|
+
import { MarkExtension, extension } from "remirror";
|
|
6803
5791
|
var LineHtmlInlineExtension = class extends MarkExtension {
|
|
6804
5792
|
get name() {
|
|
6805
5793
|
return "mdHtmlInline";
|
|
@@ -6854,7 +5842,7 @@ var LineHtmlInlineExtension = class extends MarkExtension {
|
|
|
6854
5842
|
};
|
|
6855
5843
|
LineHtmlInlineExtension.disableExtraAttributes = true;
|
|
6856
5844
|
LineHtmlInlineExtension = __decorateClass([
|
|
6857
|
-
|
|
5845
|
+
extension({
|
|
6858
5846
|
defaultOptions: {
|
|
6859
5847
|
handleViewImgSrcUrl: async (src) => src
|
|
6860
5848
|
}
|
|
@@ -6922,7 +5910,7 @@ var Emphasis = class extends MarkExtension2 {
|
|
|
6922
5910
|
}
|
|
6923
5911
|
};
|
|
6924
5912
|
__decorateClass([
|
|
6925
|
-
|
|
5913
|
+
keyBinding({ shortcut: "mod-i", command: "toggleEmphasis" })
|
|
6926
5914
|
], Emphasis.prototype, "shortcut", 1);
|
|
6927
5915
|
var Strong = class extends MarkExtension2 {
|
|
6928
5916
|
static {
|
|
@@ -6942,7 +5930,7 @@ var Strong = class extends MarkExtension2 {
|
|
|
6942
5930
|
}
|
|
6943
5931
|
};
|
|
6944
5932
|
__decorateClass([
|
|
6945
|
-
|
|
5933
|
+
keyBinding({ shortcut: "mod-b", command: "toggleStrong" })
|
|
6946
5934
|
], Strong.prototype, "shortcut", 1);
|
|
6947
5935
|
var CodeText = class extends MarkExtension2 {
|
|
6948
5936
|
static {
|
|
@@ -6962,7 +5950,7 @@ var CodeText = class extends MarkExtension2 {
|
|
|
6962
5950
|
}
|
|
6963
5951
|
};
|
|
6964
5952
|
__decorateClass([
|
|
6965
|
-
|
|
5953
|
+
keyBinding({ shortcut: "mod-e", command: "toggleCodeText" })
|
|
6966
5954
|
], CodeText.prototype, "shortcut", 1);
|
|
6967
5955
|
var CodeSpace = class extends MarkExtension2 {
|
|
6968
5956
|
static {
|
|
@@ -6996,7 +5984,7 @@ var Delete = class extends MarkExtension2 {
|
|
|
6996
5984
|
}
|
|
6997
5985
|
};
|
|
6998
5986
|
__decorateClass([
|
|
6999
|
-
|
|
5987
|
+
keyBinding({ shortcut: "mod-shift-s", command: "toggleDelete" })
|
|
7000
5988
|
], Delete.prototype, "shortcut", 1);
|
|
7001
5989
|
var LinkText = class extends MarkExtension2 {
|
|
7002
5990
|
static {
|
|
@@ -7095,7 +6083,7 @@ var ImgUri = class extends MarkExtension2 {
|
|
|
7095
6083
|
};
|
|
7096
6084
|
ImgUri.disableExtraAttributes = true;
|
|
7097
6085
|
ImgUri = __decorateClass([
|
|
7098
|
-
|
|
6086
|
+
extension2({
|
|
7099
6087
|
defaultOptions: {
|
|
7100
6088
|
handleViewImgSrcUrl: async (src) => src
|
|
7101
6089
|
}
|
|
@@ -7257,7 +6245,7 @@ var LineInlineMarkExtension = class extends PlainExtension2 {
|
|
|
7257
6245
|
};
|
|
7258
6246
|
|
|
7259
6247
|
// src/extensions/Heading/heading-extension.ts
|
|
7260
|
-
import { convertCommand as
|
|
6248
|
+
import { convertCommand as convertCommand2, findParentNodeOfType } from "@remirror/core";
|
|
7261
6249
|
import { HeadingExtension } from "remirror/extensions";
|
|
7262
6250
|
import { setBlockType } from "@remirror/pm/commands";
|
|
7263
6251
|
var LineHeadingExtension = class extends HeadingExtension {
|
|
@@ -7275,7 +6263,7 @@ var LineHeadingExtension = class extends HeadingExtension {
|
|
|
7275
6263
|
if (!selection.empty) {
|
|
7276
6264
|
return false;
|
|
7277
6265
|
}
|
|
7278
|
-
const parent =
|
|
6266
|
+
const parent = findParentNodeOfType({ types: this.type, selection });
|
|
7279
6267
|
if (parent?.start !== selection.from) {
|
|
7280
6268
|
return false;
|
|
7281
6269
|
}
|
|
@@ -7291,7 +6279,7 @@ var LineHeadingExtension = class extends HeadingExtension {
|
|
|
7291
6279
|
}
|
|
7292
6280
|
};
|
|
7293
6281
|
this.options.levels.forEach((level) => {
|
|
7294
|
-
keys[`mod-${level}`] =
|
|
6282
|
+
keys[`mod-${level}`] = convertCommand2(setBlockType(this.type, { level }));
|
|
7295
6283
|
});
|
|
7296
6284
|
return keys;
|
|
7297
6285
|
}
|
|
@@ -7462,7 +6450,7 @@ var LineBlockquoteExtension = class extends BlockquoteExtension {
|
|
|
7462
6450
|
};
|
|
7463
6451
|
|
|
7464
6452
|
// src/extensions/HardBreak/hard-break-extension.ts
|
|
7465
|
-
import { chainCommands, convertCommand as
|
|
6453
|
+
import { chainCommands, convertCommand as convertCommand3 } from "@remirror/core";
|
|
7466
6454
|
import { HardBreakExtension } from "remirror/extensions";
|
|
7467
6455
|
import { baseKeymap, exitCode } from "@remirror/pm/commands";
|
|
7468
6456
|
var needUseBrNodeNames = ["tableCell"];
|
|
@@ -7479,8 +6467,8 @@ var LineHardBreakExtension = class extends HardBreakExtension {
|
|
|
7479
6467
|
}
|
|
7480
6468
|
createKeymap() {
|
|
7481
6469
|
const disallowBreakNodes = /* @__PURE__ */ new Set(["heading"]);
|
|
7482
|
-
const enterCommand =
|
|
7483
|
-
const
|
|
6470
|
+
const enterCommand = convertCommand3(baseKeymap.Enter);
|
|
6471
|
+
const command5 = chainCommands(convertCommand3(exitCode), (params) => {
|
|
7484
6472
|
const { state, tr, dispatch } = params;
|
|
7485
6473
|
const { $from, $to, from, to } = state.selection;
|
|
7486
6474
|
const canReplace = !disallowBreakNodes.has($from.parent.type.name) && !disallowBreakNodes.has($to.parent.type.name);
|
|
@@ -7498,8 +6486,8 @@ var LineHardBreakExtension = class extends HardBreakExtension {
|
|
|
7498
6486
|
}
|
|
7499
6487
|
});
|
|
7500
6488
|
return {
|
|
7501
|
-
"Mod-Enter":
|
|
7502
|
-
"Shift-Enter":
|
|
6489
|
+
"Mod-Enter": command5,
|
|
6490
|
+
"Shift-Enter": command5
|
|
7503
6491
|
};
|
|
7504
6492
|
}
|
|
7505
6493
|
};
|
|
@@ -7533,21 +6521,21 @@ import { CountExtension } from "@remirror/extension-count";
|
|
|
7533
6521
|
var import_escape_string_regexp = __toESM(require_escape_string_regexp(), 1);
|
|
7534
6522
|
var import_string_prototype = __toESM(require_string_prototype2(), 1);
|
|
7535
6523
|
import {
|
|
7536
|
-
command
|
|
7537
|
-
extension as
|
|
7538
|
-
helper
|
|
6524
|
+
command,
|
|
6525
|
+
extension as extension3,
|
|
6526
|
+
helper,
|
|
7539
6527
|
PlainExtension as PlainExtension3
|
|
7540
6528
|
} from "@remirror/core";
|
|
7541
6529
|
import { Decoration as Decoration2, DecorationSet as DecorationSet2 } from "@remirror/pm/view";
|
|
7542
|
-
var
|
|
7543
|
-
var
|
|
7544
|
-
var
|
|
7545
|
-
var result = kind > 1 ? void 0 : kind ?
|
|
6530
|
+
var __defProp2 = Object.defineProperty;
|
|
6531
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
6532
|
+
var __decorateClass2 = (decorators, target, key, kind) => {
|
|
6533
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc2(target, key) : target;
|
|
7546
6534
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7547
6535
|
if (decorator = decorators[i])
|
|
7548
6536
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7549
6537
|
if (kind && result)
|
|
7550
|
-
|
|
6538
|
+
__defProp2(target, key, result);
|
|
7551
6539
|
return result;
|
|
7552
6540
|
};
|
|
7553
6541
|
function rotateIndex(index, length) {
|
|
@@ -7734,23 +6722,23 @@ var FindExtension = class extends PlainExtension3 {
|
|
|
7734
6722
|
(_a = dom == null ? void 0 : dom.scrollIntoView) == null ? void 0 : _a.call(dom, { block: "nearest", behavior: "smooth" });
|
|
7735
6723
|
}
|
|
7736
6724
|
};
|
|
7737
|
-
|
|
7738
|
-
|
|
6725
|
+
__decorateClass2([
|
|
6726
|
+
command()
|
|
7739
6727
|
], FindExtension.prototype, "find", 1);
|
|
7740
|
-
|
|
7741
|
-
|
|
6728
|
+
__decorateClass2([
|
|
6729
|
+
command()
|
|
7742
6730
|
], FindExtension.prototype, "stopFind", 1);
|
|
7743
|
-
|
|
7744
|
-
|
|
6731
|
+
__decorateClass2([
|
|
6732
|
+
command()
|
|
7745
6733
|
], FindExtension.prototype, "findAndReplace", 1);
|
|
7746
|
-
|
|
7747
|
-
|
|
6734
|
+
__decorateClass2([
|
|
6735
|
+
command()
|
|
7748
6736
|
], FindExtension.prototype, "findAndReplaceAll", 1);
|
|
7749
|
-
|
|
7750
|
-
|
|
6737
|
+
__decorateClass2([
|
|
6738
|
+
helper()
|
|
7751
6739
|
], FindExtension.prototype, "findRanges", 1);
|
|
7752
|
-
FindExtension =
|
|
7753
|
-
|
|
6740
|
+
FindExtension = __decorateClass2([
|
|
6741
|
+
extension3({
|
|
7754
6742
|
defaultOptions: {
|
|
7755
6743
|
decoration: { style: "background-color: yellow;" },
|
|
7756
6744
|
activeDecoration: { style: "background-color: orange;" },
|
|
@@ -7765,7 +6753,7 @@ var arrayExclude = (arr, excludeArr) => {
|
|
|
7765
6753
|
};
|
|
7766
6754
|
|
|
7767
6755
|
// src/extensions/HtmlNode/html-block-extension.ts
|
|
7768
|
-
import { NodeExtension
|
|
6756
|
+
import { NodeExtension, isElementDomNode, nodeInputRule } from "@remirror/core";
|
|
7769
6757
|
|
|
7770
6758
|
// src/extensions/HtmlNode/html-block-view.ts
|
|
7771
6759
|
import { Compartment as Compartment2 } from "@codemirror/state";
|
|
@@ -7775,7 +6763,7 @@ import { Compartment, EditorState as CodeMirrorEditorState } from "@codemirror/s
|
|
|
7775
6763
|
import { EditorView as CodeMirrorEditorView, keymap } from "@codemirror/view";
|
|
7776
6764
|
import { assertGet, isPromise, replaceNodeAtPosition } from "@remirror/core";
|
|
7777
6765
|
import { exitCode as exitCode2 } from "@remirror/pm/commands";
|
|
7778
|
-
import { Selection, TextSelection as
|
|
6766
|
+
import { Selection, TextSelection as TextSelection3 } from "@remirror/pm/state";
|
|
7779
6767
|
import { lightTheme } from "@markflowy/theme";
|
|
7780
6768
|
import { languages } from "@codemirror/language-data";
|
|
7781
6769
|
import { nanoid as nanoid2 } from "nanoid";
|
|
@@ -7922,7 +6910,7 @@ var MfCodemirrorView = class {
|
|
|
7922
6910
|
asProseMirrorSelection(doc) {
|
|
7923
6911
|
const start = this.getPos() + 1;
|
|
7924
6912
|
const { anchor, head } = this.cm.state.selection.main;
|
|
7925
|
-
return
|
|
6913
|
+
return TextSelection3.between(doc.resolve(anchor + start), doc.resolve(head + start));
|
|
7926
6914
|
}
|
|
7927
6915
|
codeMirrorKeymap() {
|
|
7928
6916
|
return [
|
|
@@ -7974,7 +6962,7 @@ var MfCodemirrorView = class {
|
|
|
7974
6962
|
tr: state.tr,
|
|
7975
6963
|
content: toggleNode.createChecked({}, this.node.content)
|
|
7976
6964
|
});
|
|
7977
|
-
tr.setSelection(
|
|
6965
|
+
tr.setSelection(TextSelection3.near(tr.doc.resolve(pos)));
|
|
7978
6966
|
this.view.dispatch(tr);
|
|
7979
6967
|
this.view.focus();
|
|
7980
6968
|
return true;
|
|
@@ -8752,7 +7740,7 @@ var pseudoClasses = /* @__PURE__ */ [
|
|
|
8752
7740
|
"visited",
|
|
8753
7741
|
"where"
|
|
8754
7742
|
].map((name) => ({ type: "class", label: name }));
|
|
8755
|
-
var
|
|
7743
|
+
var values = /* @__PURE__ */ [
|
|
8756
7744
|
"above",
|
|
8757
7745
|
"absolute",
|
|
8758
7746
|
"activeborder",
|
|
@@ -9456,7 +8444,7 @@ var defineCSSCompletionSource = (isVariable) => (context) => {
|
|
|
9456
8444
|
if (node.name == "PropertyName" || (isDash || node.name == "TagName") && /^(Block|Styles)$/.test(node.resolve(node.to).name))
|
|
9457
8445
|
return { from: node.from, options: properties(), validFor: identifier2 };
|
|
9458
8446
|
if (node.name == "ValueName")
|
|
9459
|
-
return { from: node.from, options:
|
|
8447
|
+
return { from: node.from, options: values, validFor: identifier2 };
|
|
9460
8448
|
if (node.name == "PseudoClassName")
|
|
9461
8449
|
return { from: node.from, options: pseudoClasses, validFor: identifier2 };
|
|
9462
8450
|
if (isVariable(node) || (context.explicit || isDash) && isVarArg(node, state.doc))
|
|
@@ -9477,7 +8465,7 @@ var defineCSSCompletionSource = (isVariable) => (context) => {
|
|
|
9477
8465
|
if (before && before.name == ":" && above.name == "PseudoClassSelector")
|
|
9478
8466
|
return { from: pos, options: pseudoClasses, validFor: identifier2 };
|
|
9479
8467
|
if (before && before.name == ":" && above.name == "Declaration" || above.name == "ArgList")
|
|
9480
|
-
return { from: pos, options:
|
|
8468
|
+
return { from: pos, options: values, validFor: identifier2 };
|
|
9481
8469
|
if (above.name == "Block" || above.name == "Styles")
|
|
9482
8470
|
return { from: pos, options: properties(), validFor: identifier2 };
|
|
9483
8471
|
return null;
|
|
@@ -10908,7 +9896,7 @@ var HtmlNodeView = class {
|
|
|
10908
9896
|
};
|
|
10909
9897
|
|
|
10910
9898
|
// src/extensions/HtmlNode/html-block-extension.ts
|
|
10911
|
-
import { TextSelection as
|
|
9899
|
+
import { TextSelection as TextSelection4 } from "@remirror/pm/state";
|
|
10912
9900
|
import block_names from "markdown-it/lib/common/html_blocks";
|
|
10913
9901
|
|
|
10914
9902
|
// src/extensions/CodeMirror/codemirror-utils.ts
|
|
@@ -10933,7 +9921,7 @@ function arrowHandler(dir) {
|
|
|
10933
9921
|
}
|
|
10934
9922
|
|
|
10935
9923
|
// src/extensions/HtmlNode/html-block-extension.ts
|
|
10936
|
-
var LineHtmlBlockExtension = class extends
|
|
9924
|
+
var LineHtmlBlockExtension = class extends NodeExtension {
|
|
10937
9925
|
get name() {
|
|
10938
9926
|
return "html_block";
|
|
10939
9927
|
}
|
|
@@ -10952,7 +9940,7 @@ var LineHtmlBlockExtension = class extends NodeExtension2 {
|
|
|
10952
9940
|
parseDOM: [
|
|
10953
9941
|
{
|
|
10954
9942
|
tag: "pre",
|
|
10955
|
-
getAttrs: (node) =>
|
|
9943
|
+
getAttrs: (node) => isElementDomNode(node) ? extra.parse(node) : false
|
|
10956
9944
|
},
|
|
10957
9945
|
...override.parseDOM ?? []
|
|
10958
9946
|
],
|
|
@@ -10977,7 +9965,7 @@ var LineHtmlBlockExtension = class extends NodeExtension2 {
|
|
|
10977
9965
|
type: this.type,
|
|
10978
9966
|
beforeDispatch: ({ tr, start, match }) => {
|
|
10979
9967
|
const $pos = tr.doc.resolve(start);
|
|
10980
|
-
tr.setSelection(
|
|
9968
|
+
tr.setSelection(TextSelection4.near($pos));
|
|
10981
9969
|
tr.insertText(match[0]);
|
|
10982
9970
|
}
|
|
10983
9971
|
})
|
|
@@ -11013,15 +10001,15 @@ var LineHtmlBlockExtension = class extends NodeExtension2 {
|
|
|
11013
10001
|
|
|
11014
10002
|
// src/extensions/Image/image-extension.tsx
|
|
11015
10003
|
import {
|
|
11016
|
-
command as
|
|
11017
|
-
ErrorConstant as
|
|
11018
|
-
extension as
|
|
11019
|
-
ExtensionTag
|
|
10004
|
+
command as command2,
|
|
10005
|
+
ErrorConstant as ErrorConstant2,
|
|
10006
|
+
extension as extension4,
|
|
10007
|
+
ExtensionTag,
|
|
11020
10008
|
getTextSelection,
|
|
11021
|
-
invariant
|
|
11022
|
-
isElementDomNode as
|
|
10009
|
+
invariant,
|
|
10010
|
+
isElementDomNode as isElementDomNode2,
|
|
11023
10011
|
isNumber as isNumber2,
|
|
11024
|
-
NodeExtension as
|
|
10012
|
+
NodeExtension as NodeExtension2,
|
|
11025
10013
|
nodeInputRule as nodeInputRule2,
|
|
11026
10014
|
omitExtraAttributes
|
|
11027
10015
|
} from "@remirror/core";
|
|
@@ -11070,7 +10058,7 @@ var import_make_error = __toESM(require_make_error(), 1);
|
|
|
11070
10058
|
var SELECTED_NODE_CLASS_NAME = "ProseMirror-selectednode";
|
|
11071
10059
|
var SELECTED_NODE_CLASS_SELECTOR = `.${SELECTED_NODE_CLASS_NAME}`;
|
|
11072
10060
|
var __INTERNAL_REMIRROR_IDENTIFIER_KEY__ = Symbol.for("__remirror__");
|
|
11073
|
-
var
|
|
10061
|
+
var ErrorConstant = /* @__PURE__ */ ((ErrorConstant22) => {
|
|
11074
10062
|
ErrorConstant22["PROD"] = "RMR0000";
|
|
11075
10063
|
ErrorConstant22["UNKNOWN"] = "RMR0001";
|
|
11076
10064
|
ErrorConstant22["INVALID_COMMAND_ARGUMENTS"] = "RMR0002";
|
|
@@ -11105,7 +10093,7 @@ var ErrorConstant2 = /* @__PURE__ */ ((ErrorConstant22) => {
|
|
|
11105
10093
|
ErrorConstant22["REACT_HOOKS"] = "RMR0207";
|
|
11106
10094
|
ErrorConstant22["I18N_CONTEXT"] = "RMR0300";
|
|
11107
10095
|
return ErrorConstant22;
|
|
11108
|
-
})(
|
|
10096
|
+
})(ErrorConstant || {});
|
|
11109
10097
|
|
|
11110
10098
|
// node_modules/@remirror/core-helpers/dist/remirror-core-helpers.js
|
|
11111
10099
|
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
@@ -11207,38 +10195,38 @@ function n() {
|
|
|
11207
10195
|
}
|
|
11208
10196
|
n.last = 0;
|
|
11209
10197
|
var errorMessageMap = {
|
|
11210
|
-
[
|
|
11211
|
-
[
|
|
11212
|
-
[
|
|
11213
|
-
[
|
|
11214
|
-
[
|
|
11215
|
-
[
|
|
11216
|
-
[
|
|
11217
|
-
[
|
|
11218
|
-
[
|
|
11219
|
-
[
|
|
11220
|
-
[
|
|
11221
|
-
[
|
|
11222
|
-
[
|
|
11223
|
-
[
|
|
11224
|
-
[
|
|
11225
|
-
[
|
|
11226
|
-
[
|
|
11227
|
-
[
|
|
11228
|
-
[
|
|
11229
|
-
[
|
|
11230
|
-
[
|
|
11231
|
-
[
|
|
11232
|
-
[
|
|
11233
|
-
[
|
|
11234
|
-
[
|
|
11235
|
-
[
|
|
11236
|
-
[
|
|
11237
|
-
[
|
|
11238
|
-
[
|
|
11239
|
-
[
|
|
11240
|
-
[
|
|
11241
|
-
[
|
|
10198
|
+
[ErrorConstant.UNKNOWN]: "An error occurred but we're not quite sure why. \u{1F9D0}",
|
|
10199
|
+
[ErrorConstant.INVALID_COMMAND_ARGUMENTS]: "The arguments passed to the command method were invalid.",
|
|
10200
|
+
[ErrorConstant.CUSTOM]: "This is a custom error, possibly thrown by an external library.",
|
|
10201
|
+
[ErrorConstant.CORE_HELPERS]: "An error occurred in a function called from the `@remirror/core-helpers` library.",
|
|
10202
|
+
[ErrorConstant.MUTATION]: "Mutation of immutable value detected.",
|
|
10203
|
+
[ErrorConstant.INTERNAL]: "This is an error which should not occur and is internal to the remirror codebase.",
|
|
10204
|
+
[ErrorConstant.MISSING_REQUIRED_EXTENSION]: "Your editor is missing a required extension.",
|
|
10205
|
+
[ErrorConstant.MANAGER_PHASE_ERROR]: "This occurs when accessing a method or property before it is available.",
|
|
10206
|
+
[ErrorConstant.INVALID_GET_EXTENSION]: "The user requested an invalid extension from the getExtensions method. Please check the `createExtensions` return method is returning an extension with the defined constructor.",
|
|
10207
|
+
[ErrorConstant.INVALID_MANAGER_ARGUMENTS]: "Invalid value(s) passed into `Manager` constructor. Only `Presets` and `Extensions` are supported.",
|
|
10208
|
+
[ErrorConstant.SCHEMA]: "There is a problem with the schema or you are trying to access a node / mark that doesn't exists.",
|
|
10209
|
+
[ErrorConstant.HELPERS_CALLED_IN_OUTER_SCOPE]: "The `helpers` method which is passed into the ``create*` method should only be called within returned method since it relies on an active view (not present in the outer scope).",
|
|
10210
|
+
[ErrorConstant.INVALID_MANAGER_EXTENSION]: "You requested an invalid extension from the manager.",
|
|
10211
|
+
[ErrorConstant.DUPLICATE_COMMAND_NAMES]: "Command method names must be unique within the editor.",
|
|
10212
|
+
[ErrorConstant.DUPLICATE_HELPER_NAMES]: "Helper method names must be unique within the editor.",
|
|
10213
|
+
[ErrorConstant.NON_CHAINABLE_COMMAND]: "Attempted to chain a non chainable command.",
|
|
10214
|
+
[ErrorConstant.INVALID_EXTENSION]: "The provided extension is invalid.",
|
|
10215
|
+
[ErrorConstant.INVALID_CONTENT]: "The content provided to the editor is not supported.",
|
|
10216
|
+
[ErrorConstant.INVALID_NAME]: "An invalid name was used for the extension.",
|
|
10217
|
+
[ErrorConstant.EXTENSION]: "An error occurred within an extension. More details should be made available.",
|
|
10218
|
+
[ErrorConstant.EXTENSION_SPEC]: "The spec was defined without calling the `defaults`, `parse` or `dom` methods.",
|
|
10219
|
+
[ErrorConstant.EXTENSION_EXTRA_ATTRIBUTES]: "Extra attributes must either be a string or an object.",
|
|
10220
|
+
[ErrorConstant.INVALID_SET_EXTENSION_OPTIONS]: "A call to `extension.setOptions` was made with invalid keys.",
|
|
10221
|
+
[ErrorConstant.REACT_PROVIDER_CONTEXT]: "`useRemirrorContext` was called outside of the `remirror` context. It can only be used within an active remirror context created by the `<Remirror />`.",
|
|
10222
|
+
[ErrorConstant.REACT_GET_ROOT_PROPS]: "`getRootProps` has been attached to the DOM more than once. It should only be attached to the dom once per editor.",
|
|
10223
|
+
[ErrorConstant.REACT_EDITOR_VIEW]: "A problem occurred adding the editor view to the dom.",
|
|
10224
|
+
[ErrorConstant.REACT_CONTROLLED]: "There is a problem with your controlled editor setup.",
|
|
10225
|
+
[ErrorConstant.REACT_NODE_VIEW]: "Something went wrong with your custom ReactNodeView Component.",
|
|
10226
|
+
[ErrorConstant.REACT_GET_CONTEXT]: "You attempted to call `getContext` provided by the `useRemirror` prop during the first render of the editor. This is not possible and should only be after the editor first mounts.",
|
|
10227
|
+
[ErrorConstant.REACT_COMPONENTS]: "An error occurred within a remirror component.",
|
|
10228
|
+
[ErrorConstant.REACT_HOOKS]: "An error occurred within a remirror hook.",
|
|
10229
|
+
[ErrorConstant.I18N_CONTEXT]: "You called `useI18n()` outside of an `I18nProvider` context."
|
|
11242
10230
|
};
|
|
11243
10231
|
|
|
11244
10232
|
// src/components/Resizable/ResizableHandle.tsx
|
|
@@ -11589,7 +10577,7 @@ function ImageNodeView(props) {
|
|
|
11589
10577
|
|
|
11590
10578
|
// src/extensions/Image/image-extension.tsx
|
|
11591
10579
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
11592
|
-
var HtmlImageExtension = class extends
|
|
10580
|
+
var HtmlImageExtension = class extends NodeExtension2 {
|
|
11593
10581
|
constructor() {
|
|
11594
10582
|
super(...arguments);
|
|
11595
10583
|
this.ReactComponent = (props) => {
|
|
@@ -11601,7 +10589,7 @@ var HtmlImageExtension = class extends NodeExtension3 {
|
|
|
11601
10589
|
return "html_image";
|
|
11602
10590
|
}
|
|
11603
10591
|
createTags() {
|
|
11604
|
-
return [
|
|
10592
|
+
return [ExtensionTag.InlineNode, ExtensionTag.Media];
|
|
11605
10593
|
}
|
|
11606
10594
|
createNodeSpec(extra, override) {
|
|
11607
10595
|
const { preferPastedTextContent } = this.options;
|
|
@@ -11625,7 +10613,7 @@ var HtmlImageExtension = class extends NodeExtension3 {
|
|
|
11625
10613
|
{
|
|
11626
10614
|
tag: "img[src]",
|
|
11627
10615
|
getAttrs: (element) => {
|
|
11628
|
-
if (
|
|
10616
|
+
if (isElementDomNode2(element)) {
|
|
11629
10617
|
const attrs = getImageAttributes({ element, parse: extra.parse });
|
|
11630
10618
|
if (preferPastedTextContent && attrs.src?.startsWith("file:///")) {
|
|
11631
10619
|
return false;
|
|
@@ -11756,13 +10744,13 @@ var HtmlImageExtension = class extends NodeExtension3 {
|
|
|
11756
10744
|
}
|
|
11757
10745
|
};
|
|
11758
10746
|
__decorateClass([
|
|
11759
|
-
|
|
10747
|
+
command2()
|
|
11760
10748
|
], HtmlImageExtension.prototype, "insertImage", 1);
|
|
11761
10749
|
__decorateClass([
|
|
11762
|
-
|
|
10750
|
+
command2()
|
|
11763
10751
|
], HtmlImageExtension.prototype, "uploadImage", 1);
|
|
11764
10752
|
HtmlImageExtension = __decorateClass([
|
|
11765
|
-
|
|
10753
|
+
extension4({
|
|
11766
10754
|
defaultOptions: {
|
|
11767
10755
|
createPlaceholder,
|
|
11768
10756
|
handleViewImgSrcUrl: async (src) => src,
|
|
@@ -11802,8 +10790,8 @@ function createPlaceholder() {
|
|
|
11802
10790
|
return element;
|
|
11803
10791
|
}
|
|
11804
10792
|
function uploadHandler(files) {
|
|
11805
|
-
|
|
11806
|
-
code:
|
|
10793
|
+
invariant(files.length > 0, {
|
|
10794
|
+
code: ErrorConstant2.EXTENSION,
|
|
11807
10795
|
message: "The upload handler was applied for the image extension without any valid files"
|
|
11808
10796
|
});
|
|
11809
10797
|
let completed = 0;
|
|
@@ -11835,14 +10823,14 @@ function isClipboardEvent(event) {
|
|
|
11835
10823
|
// src/extensions/Iframe/iframe-extension.tsx
|
|
11836
10824
|
var import_querystringify = __toESM(require_querystringify(), 1);
|
|
11837
10825
|
import {
|
|
11838
|
-
command as
|
|
10826
|
+
command as command3,
|
|
11839
10827
|
cx,
|
|
11840
|
-
extension as
|
|
11841
|
-
ExtensionTag as
|
|
10828
|
+
extension as extension5,
|
|
10829
|
+
ExtensionTag as ExtensionTag2,
|
|
11842
10830
|
findSelectedNodeOfType,
|
|
11843
|
-
NodeExtension as
|
|
10831
|
+
NodeExtension as NodeExtension3,
|
|
11844
10832
|
nodeInputRule as nodeInputRule3,
|
|
11845
|
-
object
|
|
10833
|
+
object,
|
|
11846
10834
|
omitExtraAttributes as omitExtraAttributes2
|
|
11847
10835
|
} from "@remirror/core";
|
|
11848
10836
|
|
|
@@ -11858,7 +10846,7 @@ function IframeNodeView(props) {
|
|
|
11858
10846
|
|
|
11859
10847
|
// src/extensions/Iframe/iframe-extension.tsx
|
|
11860
10848
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
11861
|
-
var IframeExtension = class extends
|
|
10849
|
+
var IframeExtension = class extends NodeExtension3 {
|
|
11862
10850
|
constructor() {
|
|
11863
10851
|
super(...arguments);
|
|
11864
10852
|
this.ReactComponent = (props) => {
|
|
@@ -11869,7 +10857,7 @@ var IframeExtension = class extends NodeExtension4 {
|
|
|
11869
10857
|
return "iframe_inline";
|
|
11870
10858
|
}
|
|
11871
10859
|
createTags() {
|
|
11872
|
-
return [
|
|
10860
|
+
return [ExtensionTag2.InlineNode, ExtensionTag2.Media];
|
|
11873
10861
|
}
|
|
11874
10862
|
createNodeSpec(extra, override) {
|
|
11875
10863
|
const { defaultSource } = this.options;
|
|
@@ -11988,19 +10976,19 @@ var IframeExtension = class extends NodeExtension4 {
|
|
|
11988
10976
|
}
|
|
11989
10977
|
};
|
|
11990
10978
|
__decorateClass([
|
|
11991
|
-
|
|
10979
|
+
command3()
|
|
11992
10980
|
], IframeExtension.prototype, "addIframe", 1);
|
|
11993
10981
|
__decorateClass([
|
|
11994
|
-
|
|
10982
|
+
command3()
|
|
11995
10983
|
], IframeExtension.prototype, "addYouTubeVideo", 1);
|
|
11996
10984
|
__decorateClass([
|
|
11997
|
-
|
|
10985
|
+
command3()
|
|
11998
10986
|
], IframeExtension.prototype, "updateIframeSource", 1);
|
|
11999
10987
|
__decorateClass([
|
|
12000
|
-
|
|
10988
|
+
command3()
|
|
12001
10989
|
], IframeExtension.prototype, "updateYouTubeVideo", 1);
|
|
12002
10990
|
IframeExtension = __decorateClass([
|
|
12003
|
-
|
|
10991
|
+
extension5({
|
|
12004
10992
|
defaultOptions: {
|
|
12005
10993
|
defaultSource: "",
|
|
12006
10994
|
class: "remirror-iframe",
|
|
@@ -12028,7 +11016,7 @@ function createYouTubeUrl(props) {
|
|
|
12028
11016
|
const { video, enhancedPrivacy = true, showControls = true, startAt = 0 } = props;
|
|
12029
11017
|
const id = parseUrl(video)?.searchObject?.v ?? video;
|
|
12030
11018
|
const urlStart = enhancedPrivacy ? "https://www.youtube-nocookie.com" : "https://www.youtube.com";
|
|
12031
|
-
const searchObject =
|
|
11019
|
+
const searchObject = object();
|
|
12032
11020
|
if (!showControls) {
|
|
12033
11021
|
searchObject.controls = "0";
|
|
12034
11022
|
}
|
|
@@ -12166,7 +11154,7 @@ var defaultIgnoredKeys = [
|
|
|
12166
11154
|
];
|
|
12167
11155
|
|
|
12168
11156
|
// src/extensions/SlashMenu/slashmenu-extension.ts
|
|
12169
|
-
import { PlainExtension as PlainExtension4, extension as
|
|
11157
|
+
import { PlainExtension as PlainExtension4, extension as extension6 } from "remirror";
|
|
12170
11158
|
|
|
12171
11159
|
// src/extensions/SlashMenu/case.ts
|
|
12172
11160
|
var defaultConditions = (openInSelection = false) => {
|
|
@@ -12297,13 +11285,13 @@ var SlashMenuExtension = class extends PlainExtension4 {
|
|
|
12297
11285
|
}
|
|
12298
11286
|
};
|
|
12299
11287
|
SlashMenuExtension = __decorateClass([
|
|
12300
|
-
|
|
11288
|
+
extension6({
|
|
12301
11289
|
defaultOptions: {}
|
|
12302
11290
|
})
|
|
12303
11291
|
], SlashMenuExtension);
|
|
12304
11292
|
|
|
12305
11293
|
// src/extensions/Placeholder/index.ts
|
|
12306
|
-
import { extension as
|
|
11294
|
+
import { extension as extension7, ManagerPhase, PlainExtension as PlainExtension5 } from "@remirror/core";
|
|
12307
11295
|
import { Decoration as Decoration3, DecorationSet as DecorationSet3 } from "@remirror/pm/view";
|
|
12308
11296
|
import { ExtensionPlaceholderTheme } from "@remirror/theme";
|
|
12309
11297
|
var PlaceholderExtension = class extends PlainExtension5 {
|
|
@@ -12328,7 +11316,7 @@ var PlaceholderExtension = class extends PlainExtension5 {
|
|
|
12328
11316
|
}
|
|
12329
11317
|
};
|
|
12330
11318
|
PlaceholderExtension = __decorateClass([
|
|
12331
|
-
|
|
11319
|
+
extension7({
|
|
12332
11320
|
defaultOptions: {
|
|
12333
11321
|
emptyNodeClass: ExtensionPlaceholderTheme.IS_EMPTY,
|
|
12334
11322
|
placeholder: ""
|
|
@@ -12368,23 +11356,23 @@ var Wrapper_default = styled4.div`
|
|
|
12368
11356
|
import { createReactManager } from "@remirror/react";
|
|
12369
11357
|
import { isExtension } from "@remirror/core";
|
|
12370
11358
|
import "prosemirror-flat-list/dist/style.css";
|
|
12371
|
-
function isMarkdownNodeExtension(
|
|
12372
|
-
return !!(isExtension(
|
|
11359
|
+
function isMarkdownNodeExtension(extension9) {
|
|
11360
|
+
return !!(isExtension(extension9) && extension9.fromMarkdown && extension9.toMarkdown);
|
|
12373
11361
|
}
|
|
12374
11362
|
function buildMarkdownParser(manager) {
|
|
12375
11363
|
const parserRules = [];
|
|
12376
|
-
for (const
|
|
12377
|
-
if (isMarkdownNodeExtension(
|
|
12378
|
-
parserRules.push(...
|
|
11364
|
+
for (const extension9 of manager.extensions) {
|
|
11365
|
+
if (isMarkdownNodeExtension(extension9)) {
|
|
11366
|
+
parserRules.push(...extension9.fromMarkdown());
|
|
12379
11367
|
}
|
|
12380
11368
|
}
|
|
12381
11369
|
return new MarkdownParser(manager.schema, parserRules);
|
|
12382
11370
|
}
|
|
12383
11371
|
function buildMarkdownSerializer(manager) {
|
|
12384
11372
|
const specs = {};
|
|
12385
|
-
for (const
|
|
12386
|
-
if (isMarkdownNodeExtension(
|
|
12387
|
-
specs[
|
|
11373
|
+
for (const extension9 of manager.extensions) {
|
|
11374
|
+
if (isMarkdownNodeExtension(extension9)) {
|
|
11375
|
+
specs[extension9.name] = extension9.toMarkdown;
|
|
12388
11376
|
}
|
|
12389
11377
|
}
|
|
12390
11378
|
return new MarkdownSerializer(specs);
|
|
@@ -12570,13 +11558,13 @@ function TableBar(props) {
|
|
|
12570
11558
|
var TableBar_default = TableBar;
|
|
12571
11559
|
|
|
12572
11560
|
// src/toolbar/TableToolbar/positioner.ts
|
|
12573
|
-
import { findParentNodeOfType as
|
|
12574
|
-
import { Positioner
|
|
12575
|
-
function
|
|
12576
|
-
return
|
|
11561
|
+
import { findParentNodeOfType as findParentNodeOfType2, isElementDomNode as isElementDomNode3 } from "remirror";
|
|
11562
|
+
import { Positioner, hasStateChanged, isPositionVisible } from "@remirror/extension-positioner";
|
|
11563
|
+
function findTable(selection) {
|
|
11564
|
+
return findParentNodeOfType2({ selection, types: "table" });
|
|
12577
11565
|
}
|
|
12578
|
-
function
|
|
12579
|
-
return
|
|
11566
|
+
function findCellClosestToPos(selection) {
|
|
11567
|
+
return findParentNodeOfType2({ selection, types: ["tableHeaderCell", "tableCell"] });
|
|
12580
11568
|
}
|
|
12581
11569
|
var basePosition = { y: -999999, x: -999999, width: 0, height: 0 };
|
|
12582
11570
|
var baseRect = {
|
|
@@ -12586,29 +11574,29 @@ var baseRect = {
|
|
|
12586
11574
|
bottom: -999999,
|
|
12587
11575
|
right: -999999
|
|
12588
11576
|
};
|
|
12589
|
-
var
|
|
11577
|
+
var defaultAbsolutePosition = {
|
|
12590
11578
|
...basePosition,
|
|
12591
11579
|
rect: { ...baseRect, toJSON: () => baseRect },
|
|
12592
11580
|
visible: false
|
|
12593
11581
|
};
|
|
12594
|
-
var activeCellColumnAndRowPositioner =
|
|
12595
|
-
hasChanged:
|
|
11582
|
+
var activeCellColumnAndRowPositioner = Positioner.create({
|
|
11583
|
+
hasChanged: hasStateChanged,
|
|
12596
11584
|
getActive(props) {
|
|
12597
11585
|
const { state, view } = props;
|
|
12598
11586
|
const { selection } = state;
|
|
12599
|
-
const table =
|
|
11587
|
+
const table = findTable(selection);
|
|
12600
11588
|
if (!table) {
|
|
12601
|
-
return
|
|
11589
|
+
return Positioner.EMPTY;
|
|
12602
11590
|
}
|
|
12603
|
-
const cell =
|
|
11591
|
+
const cell = findCellClosestToPos(selection);
|
|
12604
11592
|
if (!cell) {
|
|
12605
|
-
return
|
|
11593
|
+
return Positioner.EMPTY;
|
|
12606
11594
|
}
|
|
12607
11595
|
const { pos } = cell;
|
|
12608
11596
|
const tableNode = view.nodeDOM(table.pos);
|
|
12609
11597
|
const node = view.nodeDOM(pos);
|
|
12610
|
-
if (!
|
|
12611
|
-
return
|
|
11598
|
+
if (!isElementDomNode3(tableNode) || !isElementDomNode3(node)) {
|
|
11599
|
+
return Positioner.EMPTY;
|
|
12612
11600
|
}
|
|
12613
11601
|
const tableRect = tableNode.getBoundingClientRect();
|
|
12614
11602
|
const rect = node.getBoundingClientRect();
|
|
@@ -12629,8 +11617,8 @@ var activeCellColumnAndRowPositioner = Positioner2.create({
|
|
|
12629
11617
|
getPosition(props) {
|
|
12630
11618
|
const { view, data: cell } = props;
|
|
12631
11619
|
const node = view.nodeDOM(cell.pos);
|
|
12632
|
-
if (!
|
|
12633
|
-
return
|
|
11620
|
+
if (!isElementDomNode3(node)) {
|
|
11621
|
+
return defaultAbsolutePosition;
|
|
12634
11622
|
}
|
|
12635
11623
|
const rect = node.getBoundingClientRect();
|
|
12636
11624
|
const editorRect = view.dom.getBoundingClientRect();
|
|
@@ -12645,7 +11633,7 @@ var activeCellColumnAndRowPositioner = Positioner2.create({
|
|
|
12645
11633
|
width,
|
|
12646
11634
|
height,
|
|
12647
11635
|
rect: columnTopRect,
|
|
12648
|
-
visible:
|
|
11636
|
+
visible: isPositionVisible(columnTopRect, view.dom)
|
|
12649
11637
|
};
|
|
12650
11638
|
}
|
|
12651
11639
|
});
|
|
@@ -13556,18 +12544,18 @@ var codemirror_lang_menu_default = createCodeMirrorMenuDecorations;
|
|
|
13556
12544
|
|
|
13557
12545
|
// src/extensions/CodeMirror/codemirror-extension.ts
|
|
13558
12546
|
import {
|
|
13559
|
-
command as
|
|
13560
|
-
extension as
|
|
13561
|
-
findParentNodeOfType as
|
|
13562
|
-
isElementDomNode as
|
|
12547
|
+
command as command4,
|
|
12548
|
+
extension as extension8,
|
|
12549
|
+
findParentNodeOfType as findParentNodeOfType3,
|
|
12550
|
+
isElementDomNode as isElementDomNode4,
|
|
13563
12551
|
isEqual,
|
|
13564
12552
|
isTextSelection as isTextSelection3,
|
|
13565
|
-
keyBinding as
|
|
13566
|
-
NodeExtension as
|
|
12553
|
+
keyBinding as keyBinding2,
|
|
12554
|
+
NodeExtension as NodeExtension4,
|
|
13567
12555
|
nodeInputRule as nodeInputRule4,
|
|
13568
12556
|
setBlockType as setBlockType2
|
|
13569
12557
|
} from "@remirror/core";
|
|
13570
|
-
import { TextSelection as
|
|
12558
|
+
import { TextSelection as TextSelection5 } from "@remirror/pm/state";
|
|
13571
12559
|
|
|
13572
12560
|
// src/extensions/CodeMirror/codemirror-node-view.ts
|
|
13573
12561
|
var CodeMirror6NodeView = class {
|
|
@@ -13619,7 +12607,7 @@ var CodeMirror6NodeView = class {
|
|
|
13619
12607
|
// src/extensions/CodeMirror/codemirror-extension.ts
|
|
13620
12608
|
import { languages as languages3 } from "@codemirror/language-data";
|
|
13621
12609
|
var fakeIndentedLanguage = "indent-code";
|
|
13622
|
-
var LineCodeMirrorExtension = class extends
|
|
12610
|
+
var LineCodeMirrorExtension = class extends NodeExtension4 {
|
|
13623
12611
|
get name() {
|
|
13624
12612
|
return "codeMirror";
|
|
13625
12613
|
}
|
|
@@ -13638,7 +12626,7 @@ var LineCodeMirrorExtension = class extends NodeExtension5 {
|
|
|
13638
12626
|
parseDOM: [
|
|
13639
12627
|
{
|
|
13640
12628
|
tag: "pre",
|
|
13641
|
-
getAttrs: (node) =>
|
|
12629
|
+
getAttrs: (node) => isElementDomNode4(node) ? extra.parse(node) : false
|
|
13642
12630
|
},
|
|
13643
12631
|
...override.parseDOM ?? []
|
|
13644
12632
|
],
|
|
@@ -13684,7 +12672,7 @@ var LineCodeMirrorExtension = class extends NodeExtension5 {
|
|
|
13684
12672
|
type: this.type,
|
|
13685
12673
|
beforeDispatch: ({ tr, start }) => {
|
|
13686
12674
|
const $pos = tr.doc.resolve(start);
|
|
13687
|
-
tr.setSelection(
|
|
12675
|
+
tr.setSelection(TextSelection5.near($pos));
|
|
13688
12676
|
},
|
|
13689
12677
|
getAttributes
|
|
13690
12678
|
})
|
|
@@ -13713,7 +12701,7 @@ var LineCodeMirrorExtension = class extends NodeExtension5 {
|
|
|
13713
12701
|
const pos = tr.selection.$from.before();
|
|
13714
12702
|
const end = pos + nodeSize + 1;
|
|
13715
12703
|
tr.replaceWith(pos, end, this.type.create({ language }));
|
|
13716
|
-
tr.setSelection(
|
|
12704
|
+
tr.setSelection(TextSelection5.near(tr.doc.resolve(pos + 1)));
|
|
13717
12705
|
if (dispatch) {
|
|
13718
12706
|
dispatch(tr);
|
|
13719
12707
|
}
|
|
@@ -13725,7 +12713,7 @@ var LineCodeMirrorExtension = class extends NodeExtension5 {
|
|
|
13725
12713
|
updateCodeMirror(attributes) {
|
|
13726
12714
|
const type = this.type;
|
|
13727
12715
|
return ({ state, dispatch, tr }) => {
|
|
13728
|
-
const parent =
|
|
12716
|
+
const parent = findParentNodeOfType3({ types: type, selection: state.selection });
|
|
13729
12717
|
if (!parent || isEqual(attributes, parent.node.attrs)) {
|
|
13730
12718
|
return false;
|
|
13731
12719
|
}
|
|
@@ -13786,7 +12774,7 @@ var LineCodeMirrorExtension = class extends NodeExtension5 {
|
|
|
13786
12774
|
if (this.options.hideDecoration) {
|
|
13787
12775
|
return DecorationSet4.empty;
|
|
13788
12776
|
}
|
|
13789
|
-
const found =
|
|
12777
|
+
const found = findParentNodeOfType3({ types: this.type, selection: state.selection });
|
|
13790
12778
|
if (!found) {
|
|
13791
12779
|
return DecorationSet4.empty;
|
|
13792
12780
|
}
|
|
@@ -13804,19 +12792,19 @@ var LineCodeMirrorExtension = class extends NodeExtension5 {
|
|
|
13804
12792
|
}
|
|
13805
12793
|
};
|
|
13806
12794
|
__decorateClass([
|
|
13807
|
-
|
|
12795
|
+
keyBinding2({ shortcut: "Enter" })
|
|
13808
12796
|
], LineCodeMirrorExtension.prototype, "enterKey", 1);
|
|
13809
12797
|
__decorateClass([
|
|
13810
|
-
|
|
12798
|
+
command4()
|
|
13811
12799
|
], LineCodeMirrorExtension.prototype, "createCodeMirror", 1);
|
|
13812
12800
|
__decorateClass([
|
|
13813
|
-
|
|
12801
|
+
command4()
|
|
13814
12802
|
], LineCodeMirrorExtension.prototype, "updateCodeMirror", 1);
|
|
13815
12803
|
__decorateClass([
|
|
13816
|
-
|
|
12804
|
+
command4()
|
|
13817
12805
|
], LineCodeMirrorExtension.prototype, "changeCodeMirrorTheme", 1);
|
|
13818
12806
|
LineCodeMirrorExtension = __decorateClass([
|
|
13819
|
-
|
|
12807
|
+
extension8({
|
|
13820
12808
|
defaultOptions: {
|
|
13821
12809
|
hideDecoration: false,
|
|
13822
12810
|
extensions: null,
|