roosterjs-content-model-dom 0.18.0 → 0.19.0

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.
@@ -2,7 +2,7 @@ import type { ElementProcessor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * @internal
4
4
  * @param group
5
- * @param element
5
+ * @param node
6
6
  * @param context
7
7
  */
8
8
  export declare const delimiterProcessor: ElementProcessor<Node>;
@@ -1,24 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.delimiterProcessor = void 0;
4
- var tslib_1 = require("tslib");
5
- var getRegularSelectionOffsets_1 = require("../utils/getRegularSelectionOffsets");
6
- var childProcessor_1 = require("./childProcessor");
4
+ var addSelectionMarker_1 = require("../utils/addSelectionMarker");
7
5
  /**
8
6
  * @internal
9
7
  * @param group
10
- * @param element
8
+ * @param node
11
9
  * @param context
12
10
  */
13
- var delimiterProcessor = function (group, element, context) {
14
- var index = 0;
15
- var _a = (0, tslib_1.__read)((0, getRegularSelectionOffsets_1.getRegularSelectionOffsets)(context, element), 2), nodeStartOffset = _a[0], nodeEndOffset = _a[1];
16
- for (var child = element.firstChild; child; child = child.nextSibling) {
17
- (0, childProcessor_1.handleRegularSelection)(index, context, group, nodeStartOffset, nodeEndOffset);
18
- (0, exports.delimiterProcessor)(group, child, context);
19
- index++;
11
+ var delimiterProcessor = function (group, node, context) {
12
+ var _a, _b;
13
+ var range = ((_a = context.selection) === null || _a === void 0 ? void 0 : _a.type) == 'range' ? context.selection.range : null;
14
+ if (range) {
15
+ if (node.contains(range.startContainer)) {
16
+ context.isInSelection = true;
17
+ (0, addSelectionMarker_1.addSelectionMarker)(group, context);
18
+ }
19
+ if (((_b = context.selection) === null || _b === void 0 ? void 0 : _b.type) == 'range' && node.contains(range.endContainer)) {
20
+ if (!context.selection.range.collapsed) {
21
+ (0, addSelectionMarker_1.addSelectionMarker)(group, context);
22
+ }
23
+ context.isInSelection = false;
24
+ }
20
25
  }
21
- (0, childProcessor_1.handleRegularSelection)(index, context, group, nodeStartOffset, nodeEndOffset);
22
26
  };
23
27
  exports.delimiterProcessor = delimiterProcessor;
24
28
  //# sourceMappingURL=delimiterProcessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"delimiterProcessor.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-dom/lib/domToModel/processors/delimiterProcessor.ts"],"names":[],"mappings":";;;;AAAA,kFAAiF;AACjF,mDAA0D;AAG1D;;;;;GAKG;AACI,IAAM,kBAAkB,GAA2B,UAAC,KAAK,EAAE,OAAO,EAAE,OAAO;IAC9E,IAAI,KAAK,GAAG,CAAC,CAAC;IACR,IAAA,KAAA,oBAAmC,IAAA,uDAA0B,EAAC,OAAO,EAAE,OAAO,CAAC,IAAA,EAA9E,eAAe,QAAA,EAAE,aAAa,QAAgD,CAAC;IAEtF,KAAK,IAAI,KAAK,GAAG,OAAO,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE;QACnE,IAAA,uCAAsB,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;QAE9E,IAAA,0BAAkB,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC1C,KAAK,EAAE,CAAC;KACX;IAED,IAAA,uCAAsB,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;AAClF,CAAC,CAAC;AAZW,QAAA,kBAAkB,sBAY7B","sourcesContent":["import { getRegularSelectionOffsets } from '../utils/getRegularSelectionOffsets';\nimport { handleRegularSelection } from './childProcessor';\nimport type { ElementProcessor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * @param group\n * @param element\n * @param context\n */\nexport const delimiterProcessor: ElementProcessor<Node> = (group, element, context) => {\n let index = 0;\n const [nodeStartOffset, nodeEndOffset] = getRegularSelectionOffsets(context, element);\n\n for (let child = element.firstChild; child; child = child.nextSibling) {\n handleRegularSelection(index, context, group, nodeStartOffset, nodeEndOffset);\n\n delimiterProcessor(group, child, context);\n index++;\n }\n\n handleRegularSelection(index, context, group, nodeStartOffset, nodeEndOffset);\n};\n"]}
1
+ {"version":3,"file":"delimiterProcessor.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-dom/lib/domToModel/processors/delimiterProcessor.ts"],"names":[],"mappings":";;;AAAA,kEAAiE;AAGjE;;;;;GAKG;AACI,IAAM,kBAAkB,GAA2B,UAAC,KAAK,EAAE,IAAI,EAAE,OAAO;;IAC3E,IAAM,KAAK,GAAG,CAAA,MAAA,OAAO,CAAC,SAAS,0CAAE,IAAI,KAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAElF,IAAI,KAAK,EAAE;QACP,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;YACrC,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;YAE7B,IAAA,uCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;SACtC;QAED,IAAI,CAAA,MAAA,OAAO,CAAC,SAAS,0CAAE,IAAI,KAAI,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;YACzE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE;gBACpC,IAAA,uCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;aACtC;YAED,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC;SACjC;KACJ;AACL,CAAC,CAAC;AAlBW,QAAA,kBAAkB,sBAkB7B","sourcesContent":["import { addSelectionMarker } from '../utils/addSelectionMarker';\nimport type { ElementProcessor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * @param group\n * @param node\n * @param context\n */\nexport const delimiterProcessor: ElementProcessor<Node> = (group, node, context) => {\n const range = context.selection?.type == 'range' ? context.selection.range : null;\n\n if (range) {\n if (node.contains(range.startContainer)) {\n context.isInSelection = true;\n\n addSelectionMarker(group, context);\n }\n\n if (context.selection?.type == 'range' && node.contains(range.endContainer)) {\n if (!context.selection.range.collapsed) {\n addSelectionMarker(group, context);\n }\n\n context.isInSelection = false;\n }\n }\n};\n"]}
@@ -2,7 +2,7 @@ import type { ElementProcessor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * @internal
4
4
  * @param group
5
- * @param element
5
+ * @param node
6
6
  * @param context
7
7
  */
8
8
  export declare const delimiterProcessor: ElementProcessor<Node>;
@@ -1,22 +1,28 @@
1
- define(["require", "exports", "tslib", "../utils/getRegularSelectionOffsets", "./childProcessor"], function (require, exports, tslib_1, getRegularSelectionOffsets_1, childProcessor_1) {
1
+ define(["require", "exports", "../utils/addSelectionMarker"], function (require, exports, addSelectionMarker_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.delimiterProcessor = void 0;
5
5
  /**
6
6
  * @internal
7
7
  * @param group
8
- * @param element
8
+ * @param node
9
9
  * @param context
10
10
  */
11
- var delimiterProcessor = function (group, element, context) {
12
- var index = 0;
13
- var _a = (0, tslib_1.__read)((0, getRegularSelectionOffsets_1.getRegularSelectionOffsets)(context, element), 2), nodeStartOffset = _a[0], nodeEndOffset = _a[1];
14
- for (var child = element.firstChild; child; child = child.nextSibling) {
15
- (0, childProcessor_1.handleRegularSelection)(index, context, group, nodeStartOffset, nodeEndOffset);
16
- (0, exports.delimiterProcessor)(group, child, context);
17
- index++;
11
+ var delimiterProcessor = function (group, node, context) {
12
+ var _a, _b;
13
+ var range = ((_a = context.selection) === null || _a === void 0 ? void 0 : _a.type) == 'range' ? context.selection.range : null;
14
+ if (range) {
15
+ if (node.contains(range.startContainer)) {
16
+ context.isInSelection = true;
17
+ (0, addSelectionMarker_1.addSelectionMarker)(group, context);
18
+ }
19
+ if (((_b = context.selection) === null || _b === void 0 ? void 0 : _b.type) == 'range' && node.contains(range.endContainer)) {
20
+ if (!context.selection.range.collapsed) {
21
+ (0, addSelectionMarker_1.addSelectionMarker)(group, context);
22
+ }
23
+ context.isInSelection = false;
24
+ }
18
25
  }
19
- (0, childProcessor_1.handleRegularSelection)(index, context, group, nodeStartOffset, nodeEndOffset);
20
26
  };
21
27
  exports.delimiterProcessor = delimiterProcessor;
22
28
  });
@@ -1 +1 @@
1
- {"version":3,"file":"delimiterProcessor.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-dom/lib/domToModel/processors/delimiterProcessor.ts"],"names":[],"mappings":";;;;IAIA;;;;;OAKG;IACI,IAAM,kBAAkB,GAA2B,UAAC,KAAK,EAAE,OAAO,EAAE,OAAO;QAC9E,IAAI,KAAK,GAAG,CAAC,CAAC;QACR,IAAA,KAAA,oBAAmC,IAAA,uDAA0B,EAAC,OAAO,EAAE,OAAO,CAAC,IAAA,EAA9E,eAAe,QAAA,EAAE,aAAa,QAAgD,CAAC;QAEtF,KAAK,IAAI,KAAK,GAAG,OAAO,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE;YACnE,IAAA,uCAAsB,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;YAE9E,IAAA,0BAAkB,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YAC1C,KAAK,EAAE,CAAC;SACX;QAED,IAAA,uCAAsB,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;IAClF,CAAC,CAAC;IAZW,QAAA,kBAAkB,sBAY7B","sourcesContent":["import { getRegularSelectionOffsets } from '../utils/getRegularSelectionOffsets';\nimport { handleRegularSelection } from './childProcessor';\nimport type { ElementProcessor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * @param group\n * @param element\n * @param context\n */\nexport const delimiterProcessor: ElementProcessor<Node> = (group, element, context) => {\n let index = 0;\n const [nodeStartOffset, nodeEndOffset] = getRegularSelectionOffsets(context, element);\n\n for (let child = element.firstChild; child; child = child.nextSibling) {\n handleRegularSelection(index, context, group, nodeStartOffset, nodeEndOffset);\n\n delimiterProcessor(group, child, context);\n index++;\n }\n\n handleRegularSelection(index, context, group, nodeStartOffset, nodeEndOffset);\n};\n"]}
1
+ {"version":3,"file":"delimiterProcessor.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-dom/lib/domToModel/processors/delimiterProcessor.ts"],"names":[],"mappings":";;;;IAGA;;;;;OAKG;IACI,IAAM,kBAAkB,GAA2B,UAAC,KAAK,EAAE,IAAI,EAAE,OAAO;;QAC3E,IAAM,KAAK,GAAG,CAAA,MAAA,OAAO,CAAC,SAAS,0CAAE,IAAI,KAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QAElF,IAAI,KAAK,EAAE;YACP,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;gBACrC,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;gBAE7B,IAAA,uCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;aACtC;YAED,IAAI,CAAA,MAAA,OAAO,CAAC,SAAS,0CAAE,IAAI,KAAI,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;gBACzE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE;oBACpC,IAAA,uCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;iBACtC;gBAED,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC;aACjC;SACJ;IACL,CAAC,CAAC;IAlBW,QAAA,kBAAkB,sBAkB7B","sourcesContent":["import { addSelectionMarker } from '../utils/addSelectionMarker';\nimport type { ElementProcessor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * @param group\n * @param node\n * @param context\n */\nexport const delimiterProcessor: ElementProcessor<Node> = (group, node, context) => {\n const range = context.selection?.type == 'range' ? context.selection.range : null;\n\n if (range) {\n if (node.contains(range.startContainer)) {\n context.isInSelection = true;\n\n addSelectionMarker(group, context);\n }\n\n if (context.selection?.type == 'range' && node.contains(range.endContainer)) {\n if (!context.selection.range.collapsed) {\n addSelectionMarker(group, context);\n }\n\n context.isInSelection = false;\n }\n }\n};\n"]}
@@ -2,7 +2,7 @@ import type { ElementProcessor } from 'roosterjs-content-model-types';
2
2
  /**
3
3
  * @internal
4
4
  * @param group
5
- * @param element
5
+ * @param node
6
6
  * @param context
7
7
  */
8
8
  export declare const delimiterProcessor: ElementProcessor<Node>;
@@ -1,20 +1,24 @@
1
- import { __read } from "tslib";
2
- import { getRegularSelectionOffsets } from '../utils/getRegularSelectionOffsets';
3
- import { handleRegularSelection } from './childProcessor';
1
+ import { addSelectionMarker } from '../utils/addSelectionMarker';
4
2
  /**
5
3
  * @internal
6
4
  * @param group
7
- * @param element
5
+ * @param node
8
6
  * @param context
9
7
  */
10
- export var delimiterProcessor = function (group, element, context) {
11
- var index = 0;
12
- var _a = __read(getRegularSelectionOffsets(context, element), 2), nodeStartOffset = _a[0], nodeEndOffset = _a[1];
13
- for (var child = element.firstChild; child; child = child.nextSibling) {
14
- handleRegularSelection(index, context, group, nodeStartOffset, nodeEndOffset);
15
- delimiterProcessor(group, child, context);
16
- index++;
8
+ export var delimiterProcessor = function (group, node, context) {
9
+ var _a, _b;
10
+ var range = ((_a = context.selection) === null || _a === void 0 ? void 0 : _a.type) == 'range' ? context.selection.range : null;
11
+ if (range) {
12
+ if (node.contains(range.startContainer)) {
13
+ context.isInSelection = true;
14
+ addSelectionMarker(group, context);
15
+ }
16
+ if (((_b = context.selection) === null || _b === void 0 ? void 0 : _b.type) == 'range' && node.contains(range.endContainer)) {
17
+ if (!context.selection.range.collapsed) {
18
+ addSelectionMarker(group, context);
19
+ }
20
+ context.isInSelection = false;
21
+ }
17
22
  }
18
- handleRegularSelection(index, context, group, nodeStartOffset, nodeEndOffset);
19
23
  };
20
24
  //# sourceMappingURL=delimiterProcessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"delimiterProcessor.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-dom/lib/domToModel/processors/delimiterProcessor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1D;;;;;GAKG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAA2B,UAAC,KAAK,EAAE,OAAO,EAAE,OAAO;IAC9E,IAAI,KAAK,GAAG,CAAC,CAAC;IACR,IAAA,KAAA,OAAmC,0BAA0B,CAAC,OAAO,EAAE,OAAO,CAAC,IAAA,EAA9E,eAAe,QAAA,EAAE,aAAa,QAAgD,CAAC;IAEtF,KAAK,IAAI,KAAK,GAAG,OAAO,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE;QACnE,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;QAE9E,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAC1C,KAAK,EAAE,CAAC;KACX;IAED,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;AAClF,CAAC,CAAC","sourcesContent":["import { getRegularSelectionOffsets } from '../utils/getRegularSelectionOffsets';\nimport { handleRegularSelection } from './childProcessor';\nimport type { ElementProcessor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * @param group\n * @param element\n * @param context\n */\nexport const delimiterProcessor: ElementProcessor<Node> = (group, element, context) => {\n let index = 0;\n const [nodeStartOffset, nodeEndOffset] = getRegularSelectionOffsets(context, element);\n\n for (let child = element.firstChild; child; child = child.nextSibling) {\n handleRegularSelection(index, context, group, nodeStartOffset, nodeEndOffset);\n\n delimiterProcessor(group, child, context);\n index++;\n }\n\n handleRegularSelection(index, context, group, nodeStartOffset, nodeEndOffset);\n};\n"]}
1
+ {"version":3,"file":"delimiterProcessor.js","sourceRoot":"","sources":["../../../../../packages-content-model/roosterjs-content-model-dom/lib/domToModel/processors/delimiterProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE;;;;;GAKG;AACH,MAAM,CAAC,IAAM,kBAAkB,GAA2B,UAAC,KAAK,EAAE,IAAI,EAAE,OAAO;;IAC3E,IAAM,KAAK,GAAG,CAAA,MAAA,OAAO,CAAC,SAAS,0CAAE,IAAI,KAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAElF,IAAI,KAAK,EAAE;QACP,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;YACrC,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;YAE7B,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;SACtC;QAED,IAAI,CAAA,MAAA,OAAO,CAAC,SAAS,0CAAE,IAAI,KAAI,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;YACzE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE;gBACpC,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;aACtC;YAED,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC;SACjC;KACJ;AACL,CAAC,CAAC","sourcesContent":["import { addSelectionMarker } from '../utils/addSelectionMarker';\nimport type { ElementProcessor } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n * @param group\n * @param node\n * @param context\n */\nexport const delimiterProcessor: ElementProcessor<Node> = (group, node, context) => {\n const range = context.selection?.type == 'range' ? context.selection.range : null;\n\n if (range) {\n if (node.contains(range.startContainer)) {\n context.isInSelection = true;\n\n addSelectionMarker(group, context);\n }\n\n if (context.selection?.type == 'range' && node.contains(range.endContainer)) {\n if (!context.selection.range.collapsed) {\n addSelectionMarker(group, context);\n }\n\n context.isInSelection = false;\n }\n }\n};\n"]}
package/package.json CHANGED
@@ -3,9 +3,9 @@
3
3
  "description": "Content Model for roosterjs (Under development)",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.1",
6
- "roosterjs-content-model-types": "^0.18.0"
6
+ "roosterjs-content-model-types": "^0.19.0"
7
7
  },
8
- "version": "0.18.0",
8
+ "version": "0.19.0",
9
9
  "main": "./lib/index.js",
10
10
  "typings": "./lib/index.d.ts",
11
11
  "license": "MIT",