@ni/ok-components 0.1.4 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -41442,6 +41442,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
41442
41442
|
setMeta: () => setMeta,
|
|
41443
41443
|
setNode: () => setNode,
|
|
41444
41444
|
setNodeSelection: () => setNodeSelection,
|
|
41445
|
+
setTextDirection: () => setTextDirection,
|
|
41445
41446
|
setTextSelection: () => setTextSelection,
|
|
41446
41447
|
sinkListItem: () => sinkListItem,
|
|
41447
41448
|
splitBlock: () => splitBlock,
|
|
@@ -41453,6 +41454,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
41453
41454
|
undoInputRule: () => undoInputRule,
|
|
41454
41455
|
unsetAllMarks: () => unsetAllMarks,
|
|
41455
41456
|
unsetMark: () => unsetMark,
|
|
41457
|
+
unsetTextDirection: () => unsetTextDirection,
|
|
41456
41458
|
updateAttributes: () => updateAttributes,
|
|
41457
41459
|
wrapIn: () => wrapIn,
|
|
41458
41460
|
wrapInList: () => wrapInList
|
|
@@ -42228,23 +42230,28 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42228
42230
|
if (schemaType === "mark") {
|
|
42229
42231
|
markType = getMarkType(typeOrName, state.schema);
|
|
42230
42232
|
}
|
|
42231
|
-
|
|
42232
|
-
|
|
42233
|
-
|
|
42234
|
-
|
|
42233
|
+
let canReset = false;
|
|
42234
|
+
tr.selection.ranges.forEach((range) => {
|
|
42235
|
+
state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {
|
|
42236
|
+
if (nodeType && nodeType === node.type) {
|
|
42237
|
+
canReset = true;
|
|
42238
|
+
if (dispatch) {
|
|
42235
42239
|
tr.setNodeMarkup(pos, void 0, deleteProps(node.attrs, attributes));
|
|
42236
42240
|
}
|
|
42237
|
-
|
|
42238
|
-
|
|
42239
|
-
|
|
42241
|
+
}
|
|
42242
|
+
if (markType && node.marks.length) {
|
|
42243
|
+
node.marks.forEach((mark) => {
|
|
42244
|
+
if (markType === mark.type) {
|
|
42245
|
+
canReset = true;
|
|
42246
|
+
if (dispatch) {
|
|
42240
42247
|
tr.addMark(pos, pos + node.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));
|
|
42241
42248
|
}
|
|
42242
|
-
}
|
|
42243
|
-
}
|
|
42244
|
-
}
|
|
42249
|
+
}
|
|
42250
|
+
});
|
|
42251
|
+
}
|
|
42245
42252
|
});
|
|
42246
|
-
}
|
|
42247
|
-
return
|
|
42253
|
+
});
|
|
42254
|
+
return canReset;
|
|
42248
42255
|
};
|
|
42249
42256
|
|
|
42250
42257
|
// src/commands/scrollIntoView.ts
|
|
@@ -42640,12 +42647,12 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
42640
42647
|
);
|
|
42641
42648
|
}
|
|
42642
42649
|
function buildAttributeSpec(extensionAttribute) {
|
|
42643
|
-
var _a, _b
|
|
42650
|
+
var _a, _b;
|
|
42644
42651
|
const spec = {};
|
|
42645
|
-
if (!((_a = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _a.isRequired) && ((
|
|
42652
|
+
if (!((_a = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _a.isRequired) && "default" in ((extensionAttribute == null ? void 0 : extensionAttribute.attribute) || {})) {
|
|
42646
42653
|
spec.default = extensionAttribute.attribute.default;
|
|
42647
42654
|
}
|
|
42648
|
-
if (((
|
|
42655
|
+
if (((_b = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _b.validate) !== void 0) {
|
|
42649
42656
|
spec.validate = extensionAttribute.attribute.validate;
|
|
42650
42657
|
}
|
|
42651
42658
|
return [extensionAttribute.name, spec];
|
|
@@ -43283,6 +43290,35 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43283
43290
|
}
|
|
43284
43291
|
return true;
|
|
43285
43292
|
};
|
|
43293
|
+
|
|
43294
|
+
// src/commands/setTextDirection.ts
|
|
43295
|
+
var setTextDirection = (direction, position) => ({ tr, state, dispatch }) => {
|
|
43296
|
+
const { selection } = state;
|
|
43297
|
+
let from;
|
|
43298
|
+
let to;
|
|
43299
|
+
if (typeof position === "number") {
|
|
43300
|
+
from = position;
|
|
43301
|
+
to = position;
|
|
43302
|
+
} else if (position && "from" in position && "to" in position) {
|
|
43303
|
+
from = position.from;
|
|
43304
|
+
to = position.to;
|
|
43305
|
+
} else {
|
|
43306
|
+
from = selection.from;
|
|
43307
|
+
to = selection.to;
|
|
43308
|
+
}
|
|
43309
|
+
if (dispatch) {
|
|
43310
|
+
tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
43311
|
+
if (node.isText) {
|
|
43312
|
+
return;
|
|
43313
|
+
}
|
|
43314
|
+
tr.setNodeMarkup(pos, void 0, {
|
|
43315
|
+
...node.attrs,
|
|
43316
|
+
dir: direction
|
|
43317
|
+
});
|
|
43318
|
+
});
|
|
43319
|
+
}
|
|
43320
|
+
return true;
|
|
43321
|
+
};
|
|
43286
43322
|
var setTextSelection = (position) => ({ tr, dispatch }) => {
|
|
43287
43323
|
if (dispatch) {
|
|
43288
43324
|
const { doc } = tr;
|
|
@@ -43629,6 +43665,34 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43629
43665
|
return true;
|
|
43630
43666
|
};
|
|
43631
43667
|
|
|
43668
|
+
// src/commands/unsetTextDirection.ts
|
|
43669
|
+
var unsetTextDirection = (position) => ({ tr, state, dispatch }) => {
|
|
43670
|
+
const { selection } = state;
|
|
43671
|
+
let from;
|
|
43672
|
+
let to;
|
|
43673
|
+
if (typeof position === "number") {
|
|
43674
|
+
from = position;
|
|
43675
|
+
to = position;
|
|
43676
|
+
} else if (position && "from" in position && "to" in position) {
|
|
43677
|
+
from = position.from;
|
|
43678
|
+
to = position.to;
|
|
43679
|
+
} else {
|
|
43680
|
+
from = selection.from;
|
|
43681
|
+
to = selection.to;
|
|
43682
|
+
}
|
|
43683
|
+
if (dispatch) {
|
|
43684
|
+
tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
43685
|
+
if (node.isText) {
|
|
43686
|
+
return;
|
|
43687
|
+
}
|
|
43688
|
+
const newAttrs = { ...node.attrs };
|
|
43689
|
+
delete newAttrs.dir;
|
|
43690
|
+
tr.setNodeMarkup(pos, void 0, newAttrs);
|
|
43691
|
+
});
|
|
43692
|
+
}
|
|
43693
|
+
return true;
|
|
43694
|
+
};
|
|
43695
|
+
|
|
43632
43696
|
// src/commands/updateAttributes.ts
|
|
43633
43697
|
var updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
|
|
43634
43698
|
let nodeType = null;
|
|
@@ -43646,41 +43710,48 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43646
43710
|
if (schemaType === "mark") {
|
|
43647
43711
|
markType = getMarkType(typeOrName, state.schema);
|
|
43648
43712
|
}
|
|
43649
|
-
|
|
43650
|
-
|
|
43651
|
-
|
|
43652
|
-
|
|
43653
|
-
|
|
43654
|
-
|
|
43655
|
-
|
|
43656
|
-
|
|
43657
|
-
|
|
43658
|
-
|
|
43713
|
+
let canUpdate = false;
|
|
43714
|
+
tr.selection.ranges.forEach((range) => {
|
|
43715
|
+
const from = range.$from.pos;
|
|
43716
|
+
const to = range.$to.pos;
|
|
43717
|
+
let lastPos;
|
|
43718
|
+
let lastNode;
|
|
43719
|
+
let trimmedFrom;
|
|
43720
|
+
let trimmedTo;
|
|
43721
|
+
if (tr.selection.empty) {
|
|
43722
|
+
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
43723
|
+
if (nodeType && nodeType === node.type) {
|
|
43724
|
+
canUpdate = true;
|
|
43725
|
+
trimmedFrom = Math.max(pos, from);
|
|
43726
|
+
trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
43727
|
+
lastPos = pos;
|
|
43728
|
+
lastNode = node;
|
|
43729
|
+
}
|
|
43730
|
+
});
|
|
43731
|
+
} else {
|
|
43732
|
+
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
43733
|
+
if (pos < from && nodeType && nodeType === node.type) {
|
|
43734
|
+
canUpdate = true;
|
|
43735
|
+
trimmedFrom = Math.max(pos, from);
|
|
43736
|
+
trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
43737
|
+
lastPos = pos;
|
|
43738
|
+
lastNode = node;
|
|
43739
|
+
}
|
|
43740
|
+
if (pos >= from && pos <= to) {
|
|
43659
43741
|
if (nodeType && nodeType === node.type) {
|
|
43660
|
-
|
|
43661
|
-
|
|
43662
|
-
lastPos = pos;
|
|
43663
|
-
lastNode = node;
|
|
43664
|
-
}
|
|
43665
|
-
});
|
|
43666
|
-
} else {
|
|
43667
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
43668
|
-
if (pos < from && nodeType && nodeType === node.type) {
|
|
43669
|
-
trimmedFrom = Math.max(pos, from);
|
|
43670
|
-
trimmedTo = Math.min(pos + node.nodeSize, to);
|
|
43671
|
-
lastPos = pos;
|
|
43672
|
-
lastNode = node;
|
|
43673
|
-
}
|
|
43674
|
-
if (pos >= from && pos <= to) {
|
|
43675
|
-
if (nodeType && nodeType === node.type) {
|
|
43742
|
+
canUpdate = true;
|
|
43743
|
+
if (dispatch) {
|
|
43676
43744
|
tr.setNodeMarkup(pos, void 0, {
|
|
43677
43745
|
...node.attrs,
|
|
43678
43746
|
...attributes
|
|
43679
43747
|
});
|
|
43680
43748
|
}
|
|
43681
|
-
|
|
43682
|
-
|
|
43683
|
-
|
|
43749
|
+
}
|
|
43750
|
+
if (markType && node.marks.length) {
|
|
43751
|
+
node.marks.forEach((mark) => {
|
|
43752
|
+
if (markType === mark.type) {
|
|
43753
|
+
canUpdate = true;
|
|
43754
|
+
if (dispatch) {
|
|
43684
43755
|
const trimmedFrom2 = Math.max(pos, from);
|
|
43685
43756
|
const trimmedTo2 = Math.min(pos + node.nodeSize, to);
|
|
43686
43757
|
tr.addMark(
|
|
@@ -43692,36 +43763,36 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
43692
43763
|
})
|
|
43693
43764
|
);
|
|
43694
43765
|
}
|
|
43695
|
-
}
|
|
43696
|
-
}
|
|
43766
|
+
}
|
|
43767
|
+
});
|
|
43697
43768
|
}
|
|
43769
|
+
}
|
|
43770
|
+
});
|
|
43771
|
+
}
|
|
43772
|
+
if (lastNode) {
|
|
43773
|
+
if (lastPos !== void 0 && dispatch) {
|
|
43774
|
+
tr.setNodeMarkup(lastPos, void 0, {
|
|
43775
|
+
...lastNode.attrs,
|
|
43776
|
+
...attributes
|
|
43698
43777
|
});
|
|
43699
43778
|
}
|
|
43700
|
-
if (lastNode) {
|
|
43701
|
-
|
|
43702
|
-
|
|
43703
|
-
|
|
43704
|
-
|
|
43705
|
-
|
|
43706
|
-
|
|
43707
|
-
|
|
43708
|
-
|
|
43709
|
-
|
|
43710
|
-
|
|
43711
|
-
|
|
43712
|
-
|
|
43713
|
-
markType.create({
|
|
43714
|
-
...mark.attrs,
|
|
43715
|
-
...attributes
|
|
43716
|
-
})
|
|
43717
|
-
);
|
|
43718
|
-
}
|
|
43719
|
-
});
|
|
43720
|
-
}
|
|
43779
|
+
if (markType && lastNode.marks.length) {
|
|
43780
|
+
lastNode.marks.forEach((mark) => {
|
|
43781
|
+
if (markType === mark.type && dispatch) {
|
|
43782
|
+
tr.addMark(
|
|
43783
|
+
trimmedFrom,
|
|
43784
|
+
trimmedTo,
|
|
43785
|
+
markType.create({
|
|
43786
|
+
...mark.attrs,
|
|
43787
|
+
...attributes
|
|
43788
|
+
})
|
|
43789
|
+
);
|
|
43790
|
+
}
|
|
43791
|
+
});
|
|
43721
43792
|
}
|
|
43722
|
-
}
|
|
43723
|
-
}
|
|
43724
|
-
return
|
|
43793
|
+
}
|
|
43794
|
+
});
|
|
43795
|
+
return canUpdate;
|
|
43725
43796
|
};
|
|
43726
43797
|
var wrapIn = (typeOrName, attributes = {}) => ({ state, dispatch }) => {
|
|
43727
43798
|
const type = getNodeType(typeOrName, state.schema);
|
|
@@ -44577,6 +44648,7 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44577
44648
|
Keymap: () => Keymap,
|
|
44578
44649
|
Paste: () => Paste,
|
|
44579
44650
|
Tabindex: () => Tabindex,
|
|
44651
|
+
TextDirection: () => TextDirection,
|
|
44580
44652
|
focusEventsPluginKey: () => focusEventsPluginKey
|
|
44581
44653
|
});
|
|
44582
44654
|
|
|
@@ -44921,6 +44993,63 @@ so this becomes the fallback color for the slot */ ''}
|
|
|
44921
44993
|
];
|
|
44922
44994
|
}
|
|
44923
44995
|
});
|
|
44996
|
+
var TextDirection = Extension.create({
|
|
44997
|
+
name: "textDirection",
|
|
44998
|
+
addOptions() {
|
|
44999
|
+
return {
|
|
45000
|
+
direction: void 0
|
|
45001
|
+
};
|
|
45002
|
+
},
|
|
45003
|
+
addGlobalAttributes() {
|
|
45004
|
+
if (!this.options.direction) {
|
|
45005
|
+
return [];
|
|
45006
|
+
}
|
|
45007
|
+
const { nodeExtensions } = splitExtensions(this.extensions);
|
|
45008
|
+
return [
|
|
45009
|
+
{
|
|
45010
|
+
types: nodeExtensions.filter((extension) => extension.name !== "text").map((extension) => extension.name),
|
|
45011
|
+
attributes: {
|
|
45012
|
+
dir: {
|
|
45013
|
+
default: this.options.direction,
|
|
45014
|
+
parseHTML: (element) => {
|
|
45015
|
+
const dir = element.getAttribute("dir");
|
|
45016
|
+
if (dir && (dir === "ltr" || dir === "rtl" || dir === "auto")) {
|
|
45017
|
+
return dir;
|
|
45018
|
+
}
|
|
45019
|
+
return this.options.direction;
|
|
45020
|
+
},
|
|
45021
|
+
renderHTML: (attributes) => {
|
|
45022
|
+
if (!attributes.dir) {
|
|
45023
|
+
return {};
|
|
45024
|
+
}
|
|
45025
|
+
return {
|
|
45026
|
+
dir: attributes.dir
|
|
45027
|
+
};
|
|
45028
|
+
}
|
|
45029
|
+
}
|
|
45030
|
+
}
|
|
45031
|
+
}
|
|
45032
|
+
];
|
|
45033
|
+
},
|
|
45034
|
+
addProseMirrorPlugins() {
|
|
45035
|
+
return [
|
|
45036
|
+
new Plugin({
|
|
45037
|
+
key: new PluginKey("textDirection"),
|
|
45038
|
+
props: {
|
|
45039
|
+
attributes: () => {
|
|
45040
|
+
const direction = this.options.direction;
|
|
45041
|
+
if (!direction) {
|
|
45042
|
+
return {};
|
|
45043
|
+
}
|
|
45044
|
+
return {
|
|
45045
|
+
dir: direction
|
|
45046
|
+
};
|
|
45047
|
+
}
|
|
45048
|
+
}
|
|
45049
|
+
})
|
|
45050
|
+
];
|
|
45051
|
+
}
|
|
45052
|
+
});
|
|
44924
45053
|
|
|
44925
45054
|
// src/NodePos.ts
|
|
44926
45055
|
var NodePos = class _NodePos {
|
|
@@ -45213,6 +45342,7 @@ img.ProseMirror-separator {
|
|
|
45213
45342
|
extensions: [],
|
|
45214
45343
|
autofocus: false,
|
|
45215
45344
|
editable: true,
|
|
45345
|
+
textDirection: void 0,
|
|
45216
45346
|
editorProps: {},
|
|
45217
45347
|
parseOptions: {},
|
|
45218
45348
|
coreExtensionOptions: {},
|
|
@@ -45490,7 +45620,10 @@ img.ProseMirror-separator {
|
|
|
45490
45620
|
Tabindex,
|
|
45491
45621
|
Drop,
|
|
45492
45622
|
Paste,
|
|
45493
|
-
Delete
|
|
45623
|
+
Delete,
|
|
45624
|
+
TextDirection.configure({
|
|
45625
|
+
direction: this.options.textDirection
|
|
45626
|
+
})
|
|
45494
45627
|
].filter((ext) => {
|
|
45495
45628
|
if (typeof this.options.enableCoreExtensions === "object") {
|
|
45496
45629
|
return this.options.enableCoreExtensions[ext.name] !== false;
|
|
@@ -46217,6 +46350,8 @@ ${renderedContent}
|
|
|
46217
46350
|
break;
|
|
46218
46351
|
} else if (currentLine.trim() === "") {
|
|
46219
46352
|
i += 1;
|
|
46353
|
+
totalRaw = `${totalRaw}${currentLine}
|
|
46354
|
+
`;
|
|
46220
46355
|
continue;
|
|
46221
46356
|
} else {
|
|
46222
46357
|
return void 0;
|
|
@@ -46277,7 +46412,7 @@ ${renderedContent}
|
|
|
46277
46412
|
}
|
|
46278
46413
|
return {
|
|
46279
46414
|
items,
|
|
46280
|
-
raw: totalRaw
|
|
46415
|
+
raw: totalRaw
|
|
46281
46416
|
};
|
|
46282
46417
|
}
|
|
46283
46418
|
|
|
@@ -62325,7 +62460,7 @@ ${nextLine.slice(indentLevel + 2)}`;
|
|
|
62325
62460
|
addProseMirrorPlugins() {
|
|
62326
62461
|
var _a;
|
|
62327
62462
|
const plugin = new PluginKey(this.name);
|
|
62328
|
-
const defaultNode = ((_a = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : _a.name) ||
|
|
62463
|
+
const defaultNode = this.options.node || ((_a = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : _a.name) || "paragraph";
|
|
62329
62464
|
const disabledNodes = Object.entries(this.editor.schema.nodes).map(([, value]) => value).filter((node) => (this.options.notAfter || []).concat(defaultNode).includes(node.name));
|
|
62330
62465
|
return [
|
|
62331
62466
|
new Plugin({
|
|
@@ -69946,6 +70081,11 @@ focus outline in that case.
|
|
|
69946
70081
|
/** @internal */
|
|
69947
70082
|
onCellActionMenuToggle(event, column) {
|
|
69948
70083
|
this.menuOpen = event.detail.newState;
|
|
70084
|
+
// Workaround for Firefox issue when action menus opened on different rows
|
|
70085
|
+
// See: https://github.com/ni/nimble/issues/2744
|
|
70086
|
+
if (!event.detail.newState) {
|
|
70087
|
+
this.currentActionMenuColumn = undefined;
|
|
70088
|
+
}
|
|
69949
70089
|
this.emitActionMenuToggleEvent('row-action-menu-toggle', event.detail, column);
|
|
69950
70090
|
}
|
|
69951
70091
|
/** @internal */
|