Skip to content

Commit 15a3a08

Browse files
committed
add blockElementTags to processors
1 parent 5e4b363 commit 15a3a08

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @code.store/arcxp-sdk-ts
22

3+
## 5.3.2
4+
5+
### Patch Changes
6+
7+
- add blockElementTags to processors
8+
39
## 5.3.1
410

511
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@code.store/arcxp-sdk-ts",
3-
"version": "5.3.1",
3+
"version": "5.3.2",
44
"description": "A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.",
55
"type": "module",
66
"main": "./dist/index.js",

src/content-elements/html/html.processor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export type WrapHandler = (node: Node, content: ContentElementType<'text'>) => C
3939
* using the `handle()` and `wrap()` methods.
4040
*/
4141
export class HTMLProcessor {
42+
protected blockElementTags = BLOCK_ELEMENT_TAGS;
4243
protected parallelProcessing = true;
4344

4445
protected handlers = {
@@ -426,7 +427,7 @@ export class HTMLProcessor {
426427
protected isBlockElement(node: Node) {
427428
if (!isHTMLElement(node)) return false;
428429

429-
const defaultBlockElements = new Set(BLOCK_ELEMENT_TAGS);
430+
const defaultBlockElements = new Set(this.blockElementTags);
430431
return defaultBlockElements.has(node.tagName);
431432
}
432433

src/content-elements/xml/xml.processor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export type NodeHandler = (node: xmldoc.XmlNodeBase) => MaybePromise<CElement[]
1313
export type WrapHandler = (node: xmldoc.XmlElement, content: string) => string;
1414

1515
export class XMLProcessor {
16+
protected blockElementTags = BLOCK_ELEMENT_TAGS;
17+
1618
protected handlers = {
1719
node: new Map<string, NodeHandler>(),
1820
wrap: new Map<string, WrapHandler>(),
@@ -228,7 +230,7 @@ export class XMLProcessor {
228230
}
229231

230232
protected isBlockElement(node: xmldoc.XmlElement) {
231-
const defaultBlockElements = new Set(BLOCK_ELEMENT_TAGS);
233+
const defaultBlockElements = new Set(this.blockElementTags);
232234
if (defaultBlockElements.has(node.name)) return true;
233235
}
234236

0 commit comments

Comments
 (0)