@lblod/ember-rdfa-editor 13.3.1 → 13.4.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.
- package/declarations/core/rdfa-types.d.ts +6 -2
- package/declarations/core/schema/_private/migrations.d.ts +3 -0
- package/declarations/nodes/invisible-rdfa.d.ts +6 -0
- package/dist/core/rdfa-types.js +2 -0
- package/dist/core/rdfa-types.js.map +1 -1
- package/dist/core/schema/_private/migrations.js +36 -0
- package/dist/core/schema/_private/migrations.js.map +1 -0
- package/dist/nodes/block-rdfa.js +7 -20
- package/dist/nodes/block-rdfa.js.map +1 -1
- package/dist/nodes/inline-rdfa.js +4 -18
- package/dist/nodes/inline-rdfa.js.map +1 -1
- package/dist/nodes/invisible-rdfa.js +13 -7
- package/dist/nodes/invisible-rdfa.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,11 @@ export declare function isLiteralAttrs(attrs: RdfaAttrs): attrs is RdfaLiteralAt
|
|
|
27
27
|
export type ModelMigration = {
|
|
28
28
|
/** A modified contentElement function to allow for nested structures to be modified **/
|
|
29
29
|
contentElement?: (element: HTMLElement) => HTMLElement;
|
|
30
|
-
/**
|
|
31
|
-
|
|
30
|
+
/**
|
|
31
|
+
* A modified getAttrs that returns attrs matching the new model. False or null are handled in
|
|
32
|
+
* the same way as normal prosemirror TagParseRule getAttrs functions.
|
|
33
|
+
**/
|
|
34
|
+
getAttrs?: (element: HTMLElement) => RdfaAttrs | false | null;
|
|
32
35
|
};
|
|
36
|
+
/** A function that returns either the desired migration or false if there is nothing to do **/
|
|
33
37
|
export type ModelMigrationGenerator = (attrs: RdfaAttrs) => false | ModelMigration;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type ModelMigrationGenerator, type RdfaAttrs } from '../../rdfa-types.ts';
|
|
2
|
+
export declare function getAttrsWithMigrations(modelMigrations: ModelMigrationGenerator[], attrs: Record<string, string>, element: HTMLElement): false | Record<string, string> | RdfaAttrs | null;
|
|
3
|
+
export declare function contentElementWithMigrations(modelMigrations: ModelMigrationGenerator[], rdfaAware: boolean, element: HTMLElement): HTMLElement;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type SayNodeSpec from '../core/say-node-spec.ts';
|
|
2
|
+
import { type ModelMigrationGenerator } from '../core/rdfa-types.ts';
|
|
2
3
|
type Options = {
|
|
3
4
|
rdfaAware?: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Migrations to apply to nodes parsed as block-rdfa, to modify the data model.
|
|
7
|
+
* @returns false to use the default parsing or an object to define overrides
|
|
8
|
+
**/
|
|
9
|
+
modelMigrations?: ModelMigrationGenerator[];
|
|
4
10
|
};
|
|
5
11
|
export declare const invisibleRdfaWithConfig: (options?: Options) => SayNodeSpec;
|
|
6
12
|
/**
|
package/dist/core/rdfa-types.js
CHANGED
|
@@ -22,5 +22,7 @@ function isLiteralAttrs(attrs) {
|
|
|
22
22
|
return attrs.rdfaNodeType === 'literal';
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/** A function that returns either the desired migration or false if there is nothing to do **/
|
|
26
|
+
|
|
25
27
|
export { isLiteralAttrs, isRdfaAttrs, isResourceAttrs, rdfaNodeTypes };
|
|
26
28
|
//# sourceMappingURL=rdfa-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rdfa-types.js","sources":["../../src/core/rdfa-types.ts"],"sourcesContent":["import { type Attrs } from 'prosemirror-model';\nimport {\n type FullTriple,\n type IncomingTriple,\n type OutgoingTriple,\n} from './rdfa-processor.ts';\nimport { type SayNamedNode } from './say-data-factory/index.ts';\n\n// These types moved here to avoid circular dependencies\n\nexport const rdfaNodeTypes = ['resource', 'literal'] as const;\nexport interface RdfaAwareAttrs {\n __rdfaId: string;\n rdfaNodeType: (typeof rdfaNodeTypes)[number];\n backlinks: IncomingTriple[];\n externalTriples?: FullTriple[];\n}\nexport interface RdfaLiteralAttrs extends RdfaAwareAttrs {\n rdfaNodeType: 'literal';\n content: string | null;\n datatype?: SayNamedNode | null;\n language?: string | null;\n}\nexport interface RdfaResourceAttrs extends RdfaAwareAttrs {\n rdfaNodeType: 'resource';\n externalTriples?: FullTriple[];\n subject: string;\n properties: OutgoingTriple[];\n}\nexport type RdfaAttrs = RdfaLiteralAttrs | RdfaResourceAttrs;\n\nexport function isRdfaAttrs(attrs: Attrs): attrs is RdfaAttrs {\n return (\n '__rdfaId' in attrs &&\n 'backlinks' in attrs &&\n rdfaNodeTypes.includes(attrs['rdfaNodeType'] as 'resource' | 'literal')\n );\n}\n\nexport function isResourceAttrs(attrs: RdfaAttrs): attrs is RdfaResourceAttrs {\n return attrs.rdfaNodeType === 'resource';\n}\nexport function isLiteralAttrs(attrs: RdfaAttrs): attrs is RdfaLiteralAttrs {\n return attrs.rdfaNodeType === 'literal';\n}\n\nexport type ModelMigration = {\n /** A modified contentElement function to allow for nested structures to be modified **/\n contentElement?: (element: HTMLElement) => HTMLElement;\n
|
|
1
|
+
{"version":3,"file":"rdfa-types.js","sources":["../../src/core/rdfa-types.ts"],"sourcesContent":["import { type Attrs } from 'prosemirror-model';\nimport {\n type FullTriple,\n type IncomingTriple,\n type OutgoingTriple,\n} from './rdfa-processor.ts';\nimport { type SayNamedNode } from './say-data-factory/index.ts';\n\n// These types moved here to avoid circular dependencies\n\nexport const rdfaNodeTypes = ['resource', 'literal'] as const;\nexport interface RdfaAwareAttrs {\n __rdfaId: string;\n rdfaNodeType: (typeof rdfaNodeTypes)[number];\n backlinks: IncomingTriple[];\n externalTriples?: FullTriple[];\n}\nexport interface RdfaLiteralAttrs extends RdfaAwareAttrs {\n rdfaNodeType: 'literal';\n content: string | null;\n datatype?: SayNamedNode | null;\n language?: string | null;\n}\nexport interface RdfaResourceAttrs extends RdfaAwareAttrs {\n rdfaNodeType: 'resource';\n externalTriples?: FullTriple[];\n subject: string;\n properties: OutgoingTriple[];\n}\nexport type RdfaAttrs = RdfaLiteralAttrs | RdfaResourceAttrs;\n\nexport function isRdfaAttrs(attrs: Attrs): attrs is RdfaAttrs {\n return (\n '__rdfaId' in attrs &&\n 'backlinks' in attrs &&\n rdfaNodeTypes.includes(attrs['rdfaNodeType'] as 'resource' | 'literal')\n );\n}\n\nexport function isResourceAttrs(attrs: RdfaAttrs): attrs is RdfaResourceAttrs {\n return attrs.rdfaNodeType === 'resource';\n}\nexport function isLiteralAttrs(attrs: RdfaAttrs): attrs is RdfaLiteralAttrs {\n return attrs.rdfaNodeType === 'literal';\n}\n\nexport type ModelMigration = {\n /** A modified contentElement function to allow for nested structures to be modified **/\n contentElement?: (element: HTMLElement) => HTMLElement;\n /**\n * A modified getAttrs that returns attrs matching the new model. False or null are handled in\n * the same way as normal prosemirror TagParseRule getAttrs functions.\n **/\n getAttrs?: (element: HTMLElement) => RdfaAttrs | false | null;\n};\n/** A function that returns either the desired migration or false if there is nothing to do **/\nexport type ModelMigrationGenerator = (\n attrs: RdfaAttrs,\n) => false | ModelMigration;\n"],"names":["rdfaNodeTypes","isRdfaAttrs","attrs","includes","isResourceAttrs","rdfaNodeType","isLiteralAttrs"],"mappings":";;;;;;;;;;;AAQA;;MAEaA,aAAa,GAAG,CAAC,UAAU,EAAE,SAAS;AAqB5C,SAASC,WAAWA,CAACC,KAAY,EAAsB;AAC5D,EAAA,OACE,UAAU,IAAIA,KAAK,IACnB,WAAW,IAAIA,KAAK,IACpBF,aAAa,CAACG,QAAQ,CAACD,KAAK,CAAC,cAAc,CAA2B,CAAC;AAE3E;AAEO,SAASE,eAAeA,CAACF,KAAgB,EAA8B;AAC5E,EAAA,OAAOA,KAAK,CAACG,YAAY,KAAK,UAAU;AAC1C;AACO,SAASC,cAAcA,CAACJ,KAAgB,EAA6B;AAC1E,EAAA,OAAOA,KAAK,CAACG,YAAY,KAAK,SAAS;AACzC;;AAWA;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import 'prosemirror-model';
|
|
2
|
+
import 'uuid';
|
|
3
|
+
import '../../../utils/_private/constants.js';
|
|
4
|
+
import 'relative-to-absolute-iri';
|
|
5
|
+
import 'rdf-data-factory';
|
|
6
|
+
import '../../../main-DFf-0En3.js';
|
|
7
|
+
import '../../say-data-factory/data-factory.js';
|
|
8
|
+
import '../../say-data-factory/default-graph.js';
|
|
9
|
+
import '../../../config/rdfa.js';
|
|
10
|
+
import 'iter-tools';
|
|
11
|
+
import { getRdfaAttrs, getRdfaContentElement } from '../../schema.js';
|
|
12
|
+
|
|
13
|
+
function getAttrsWithMigrations(modelMigrations, attrs, element) {
|
|
14
|
+
const migration = modelMigrations.find(migration => migration(attrs))?.(attrs);
|
|
15
|
+
if (migration && migration.getAttrs) {
|
|
16
|
+
return migration.getAttrs(element);
|
|
17
|
+
}
|
|
18
|
+
return attrs;
|
|
19
|
+
}
|
|
20
|
+
function contentElementWithMigrations(modelMigrations, rdfaAware, element) {
|
|
21
|
+
if (rdfaAware && modelMigrations.length > 0) {
|
|
22
|
+
const attrs = getRdfaAttrs(element, {
|
|
23
|
+
rdfaAware
|
|
24
|
+
});
|
|
25
|
+
if (attrs) {
|
|
26
|
+
const migration = modelMigrations.find(migration => migration(attrs))?.(attrs);
|
|
27
|
+
if (migration && migration.contentElement) {
|
|
28
|
+
return migration.contentElement(element);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return getRdfaContentElement(element);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { contentElementWithMigrations, getAttrsWithMigrations };
|
|
36
|
+
//# sourceMappingURL=migrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations.js","sources":["../../../../src/core/schema/_private/migrations.ts"],"sourcesContent":["import {\n type ModelMigrationGenerator,\n type RdfaAttrs,\n} from '../../rdfa-types.ts';\nimport { getRdfaAttrs, getRdfaContentElement } from '../../schema.ts';\n\nexport function getAttrsWithMigrations(\n modelMigrations: ModelMigrationGenerator[],\n attrs: Record<string, string>,\n element: HTMLElement,\n) {\n const migration = modelMigrations.find((migration) =>\n migration(attrs as unknown as RdfaAttrs),\n )?.(attrs as unknown as RdfaAttrs);\n if (migration && migration.getAttrs) {\n return migration.getAttrs(element);\n }\n return attrs;\n}\n\nexport function contentElementWithMigrations(\n modelMigrations: ModelMigrationGenerator[],\n rdfaAware: boolean,\n element: HTMLElement,\n) {\n if (rdfaAware && modelMigrations.length > 0) {\n const attrs = getRdfaAttrs(element, { rdfaAware });\n if (attrs) {\n const migration = modelMigrations.find((migration) =>\n migration(attrs as unknown as RdfaAttrs),\n )?.(attrs as unknown as RdfaAttrs);\n if (migration && migration.contentElement) {\n return migration.contentElement(element);\n }\n }\n }\n return getRdfaContentElement(element);\n}\n"],"names":["getAttrsWithMigrations","modelMigrations","attrs","element","migration","find","getAttrs","contentElementWithMigrations","rdfaAware","length","getRdfaAttrs","contentElement","getRdfaContentElement"],"mappings":";;;;;;;;;;;;AAMO,SAASA,sBAAsBA,CACpCC,eAA0C,EAC1CC,KAA6B,EAC7BC,OAAoB,EACpB;AACA,EAAA,MAAMC,SAAS,GAAGH,eAAe,CAACI,IAAI,CAAED,SAAS,IAC/CA,SAAS,CAACF,KAA6B,CACzC,CAAC,GAAGA,KAA6B,CAAC;AAClC,EAAA,IAAIE,SAAS,IAAIA,SAAS,CAACE,QAAQ,EAAE;AACnC,IAAA,OAAOF,SAAS,CAACE,QAAQ,CAACH,OAAO,CAAC;AACpC,EAAA;AACA,EAAA,OAAOD,KAAK;AACd;AAEO,SAASK,4BAA4BA,CAC1CN,eAA0C,EAC1CO,SAAkB,EAClBL,OAAoB,EACpB;AACA,EAAA,IAAIK,SAAS,IAAIP,eAAe,CAACQ,MAAM,GAAG,CAAC,EAAE;AAC3C,IAAA,MAAMP,KAAK,GAAGQ,YAAY,CAACP,OAAO,EAAE;AAAEK,MAAAA;AAAU,KAAC,CAAC;AAClD,IAAA,IAAIN,KAAK,EAAE;AACT,MAAA,MAAME,SAAS,GAAGH,eAAe,CAACI,IAAI,CAAED,SAAS,IAC/CA,SAAS,CAACF,KAA6B,CACzC,CAAC,GAAGA,KAA6B,CAAC;AAClC,MAAA,IAAIE,SAAS,IAAIA,SAAS,CAACO,cAAc,EAAE;AACzC,QAAA,OAAOP,SAAS,CAACO,cAAc,CAACR,OAAO,CAAC;AAC1C,MAAA;AACF,IAAA;AACF,EAAA;EACA,OAAOS,qBAAqB,CAACT,OAAO,CAAC;AACvC;;;;"}
|
package/dist/nodes/block-rdfa.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import 'prosemirror-model';
|
|
2
2
|
import { isRdfaAttrs } from '../core/rdfa-types.js';
|
|
3
|
-
import { rdfaAttrSpec, renderRdfaAware, getRdfaAttrs
|
|
3
|
+
import { rdfaAttrSpec, renderRdfaAware, getRdfaAttrs } from '../core/schema.js';
|
|
4
4
|
import { SKOS, RDF } from '../utils/_private/namespaces.js';
|
|
5
5
|
import { getRDFFragment } from '../utils/namespace.js';
|
|
6
6
|
import getClassnamesFromNode from '../utils/get-classnames-from-node.js';
|
|
7
7
|
import { selectNodeByRdfaId } from '../commands/_private/rdfa-commands/select-node-by-rdfa-id.js';
|
|
8
|
+
import { contentElementWithMigrations, getAttrsWithMigrations } from '../core/schema/_private/migrations.js';
|
|
8
9
|
|
|
9
10
|
const FALLBACK_LABEL = 'Data-object';
|
|
10
11
|
const blockRdfaWithConfig = ({
|
|
@@ -36,34 +37,20 @@ const blockRdfaWithConfig = ({
|
|
|
36
37
|
if (typeof element === 'string') {
|
|
37
38
|
return false;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
+
let attrs = getRdfaAttrs(element, {
|
|
40
41
|
rdfaAware
|
|
41
42
|
});
|
|
42
43
|
if (attrs) {
|
|
43
|
-
|
|
44
|
-
if (migration && migration.getAttrs) {
|
|
45
|
-
return migration.getAttrs(element);
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
44
|
+
attrs = {
|
|
48
45
|
...attrs,
|
|
49
|
-
label: element.dataset['label']
|
|
46
|
+
label: element.dataset['label'] ?? attrs['label']
|
|
50
47
|
};
|
|
48
|
+
return getAttrsWithMigrations(modelMigrations, attrs, element);
|
|
51
49
|
}
|
|
52
50
|
return false;
|
|
53
51
|
},
|
|
54
52
|
contentElement: element => {
|
|
55
|
-
|
|
56
|
-
const attrs = getRdfaAttrs(element, {
|
|
57
|
-
rdfaAware
|
|
58
|
-
});
|
|
59
|
-
if (attrs) {
|
|
60
|
-
const migration = modelMigrations.find(migration => migration(attrs))?.(attrs);
|
|
61
|
-
if (migration && migration.contentElement) {
|
|
62
|
-
return migration.contentElement(element);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return getRdfaContentElement(element);
|
|
53
|
+
return contentElementWithMigrations(modelMigrations, rdfaAware, element);
|
|
67
54
|
}
|
|
68
55
|
}],
|
|
69
56
|
toDOM(node) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-rdfa.js","sources":["../../src/nodes/block-rdfa.ts"],"sourcesContent":["import { Node as PNode } from 'prosemirror-model';\nimport {\n isRdfaAttrs,\n type ModelMigrationGenerator,\n type RdfaAttrs,\n} from '#root/core/rdfa-types.ts';\nimport {\n getRdfaAttrs,\n getRdfaContentElement,\n rdfaAttrSpec,\n renderRdfaAware,\n} from '#root/core/schema.ts';\nimport type SayNodeSpec from '../core/say-node-spec.ts';\nimport type { NodeView, NodeViewConstructor } from 'prosemirror-view';\nimport { RDF, SKOS } from '../utils/_private/namespaces.ts';\nimport { getRDFFragment } from '../utils/namespace.ts';\nimport getClassnamesFromNode from '../utils/get-classnames-from-node.ts';\nimport type SayController from '#root/core/say-controller.ts';\nimport { selectNodeByRdfaId } from '#root/commands/_private/rdfa-commands/select-node-by-rdfa-id.ts';\n\nconst FALLBACK_LABEL = 'Data-object';\n\ntype Config = {\n rdfaAware?: boolean;\n /**\n * Migrations to apply to nodes parsed as block-rdfa, to modify the data model.\n * @returns false to use the default parsing or an object to define overrides\n **/\n modelMigrations?: ModelMigrationGenerator[];\n};\n\nexport const blockRdfaWithConfig: (config?: Config) => SayNodeSpec = ({\n rdfaAware = false,\n modelMigrations = [],\n} = {}) => {\n return {\n content: 'block+',\n group: 'block',\n attrs: {\n ...rdfaAttrSpec({ rdfaAware }),\n label: {\n default: undefined,\n editable: true,\n },\n },\n definingAsContext: true,\n editable: rdfaAware,\n isolating: rdfaAware,\n selectable: rdfaAware,\n classNames: ['say-block-rdfa'],\n parseDOM: [\n {\n tag: `p, div, address, article, aside, blockquote, details, dialog, dd, dt, fieldset, figcaption, figure, footer, form, header, hgroup, hr, main, nav, pre, section`,\n // Default priority is 50, so this means a more specific definition matches before this one\n priority: 40,\n getAttrs(element: string | HTMLElement) {\n if (typeof element === 'string') {\n return false;\n }\n const attrs = getRdfaAttrs(element, { rdfaAware });\n if (attrs) {\n const migration = modelMigrations.find((migration) =>\n migration(attrs as unknown as RdfaAttrs),\n )?.(attrs as unknown as RdfaAttrs);\n if (migration && migration.getAttrs) {\n return migration.getAttrs(element);\n }\n return { ...attrs, label: element.dataset['label'] };\n }\n return false;\n },\n contentElement: (element) => {\n if (rdfaAware && modelMigrations.length > 0) {\n const attrs = getRdfaAttrs(element, { rdfaAware });\n if (attrs) {\n const migration = modelMigrations.find((migration) =>\n migration(attrs as unknown as RdfaAttrs),\n )?.(attrs as unknown as RdfaAttrs);\n if (migration && migration.contentElement) {\n return migration.contentElement(element);\n }\n }\n }\n return getRdfaContentElement(element);\n },\n },\n ],\n toDOM(node: PNode) {\n if (rdfaAware) {\n return renderRdfaAware({\n renderable: node,\n tag: 'div',\n attrs: {\n class: `say-editable ${getClassnamesFromNode(node)}`,\n 'data-label': node.attrs['label'] as string,\n },\n content: 0,\n });\n } else {\n const { label, ...attrs } = node.attrs;\n return [\n 'div',\n {\n ...attrs,\n 'data-label': label as string,\n class: getClassnamesFromNode(node),\n },\n 0,\n ];\n }\n },\n };\n};\n\nexport class BlockRDFaView implements NodeView {\n dom: HTMLElement;\n labelElement: HTMLElement;\n contentDOM: HTMLElement;\n node: PNode;\n controller?: SayController;\n onClickRef: () => void;\n\n /**\n * @deprecated The SayController should now be passed to this nodeview to allow focusing nodes on\n * label clicks\n */\n constructor(node: PNode);\n constructor(\n nodeViewArgs: Parameters<NodeViewConstructor>,\n controller: SayController,\n );\n constructor(\n nodeViewArgs: Parameters<NodeViewConstructor> | PNode,\n controller?: SayController,\n ) {\n this.node = Array.isArray(nodeViewArgs) ? nodeViewArgs[0] : nodeViewArgs;\n this.dom = document.createElement('div');\n this.dom.setAttribute('class', 'say-block-rdfa');\n this.labelElement = this.dom.appendChild(document.createElement('span'));\n this.labelElement.contentEditable = 'false';\n this.labelElement.textContent = getBlockRDFaLabel(\n this.node,\n FALLBACK_LABEL,\n ).toUpperCase();\n this.labelElement.setAttribute('class', 'say-block-rdfa--label');\n // Save a ref to an arrow function as we can't use class methods directly here\n this.onClickRef = () => this.onClick();\n this.labelElement.addEventListener('click', this.onClickRef);\n this.controller = controller;\n this.contentDOM = this.dom.appendChild(document.createElement('div'));\n }\n\n destroy() {\n removeEventListener('click', this.onClickRef);\n }\n\n onClick() {\n if (this.controller) {\n this.controller.doCommand(\n selectNodeByRdfaId({\n rdfaId: this.node.attrs['__rdfaId'] as string,\n dontScroll: true,\n }),\n {\n view: this.controller.mainEditorView,\n },\n );\n }\n }\n\n update(node: PNode) {\n if (node.type != this.node.type) {\n return false;\n }\n this.node = node;\n this.labelElement.textContent = getBlockRDFaLabel(\n node,\n FALLBACK_LABEL,\n ).toUpperCase();\n return true;\n }\n}\n\n/**\n * Function that determines which label should be shown on the `block_rdfa` node\n * Priority:\n * 1. The `label` attribute\n * 2. Value of first encountered `skos:prefLabel` attribute (if resource node)\n * 3. Last part of the first encountered type/predicate URI\n * 4. The value of the `fallback` argument\n */\nfunction getBlockRDFaLabel(node: PNode, fallback: string) {\n const { attrs } = node;\n if (attrs['label']) {\n return attrs['label'] as string;\n }\n // Node is not rdfa-aware\n if (!isRdfaAttrs(attrs)) {\n return 'Data-object';\n }\n\n const { rdfaNodeType } = attrs;\n if (rdfaNodeType === 'resource') {\n const { properties } = attrs;\n const prefLabelProps = properties.filter(\n (prop) =>\n prop.object.termType === 'Literal' &&\n SKOS('prefLabel').matches(prop.predicate),\n );\n if (prefLabelProps.length) {\n return prefLabelProps[0].object.value;\n } else {\n const typeProp = properties.find(\n (prop) =>\n prop.object.termType === 'NamedNode' &&\n RDF('type').matches(prop.predicate),\n );\n if (typeProp) {\n return getRDFFragment(typeProp.object.value);\n } else {\n return fallback;\n }\n }\n } else {\n const { backlinks } = attrs;\n if (backlinks.length) {\n return getRDFFragment(backlinks[0].predicate);\n } else {\n return fallback;\n }\n }\n}\n\n/**\n * @deprecated use `blockRdfaWithConfig` instead\n */\nexport const block_rdfa = blockRdfaWithConfig();\n"],"names":["FALLBACK_LABEL","blockRdfaWithConfig","rdfaAware","modelMigrations","content","group","attrs","rdfaAttrSpec","label","default","undefined","editable","definingAsContext","isolating","selectable","classNames","parseDOM","tag","priority","getAttrs","element","getRdfaAttrs","migration","find","dataset","contentElement","length","getRdfaContentElement","toDOM","node","renderRdfaAware","renderable","class","getClassnamesFromNode","BlockRDFaView","dom","labelElement","contentDOM","controller","onClickRef","constructor","nodeViewArgs","Array","isArray","document","createElement","setAttribute","appendChild","contentEditable","textContent","getBlockRDFaLabel","toUpperCase","onClick","addEventListener","destroy","removeEventListener","doCommand","selectNodeByRdfaId","rdfaId","dontScroll","view","mainEditorView","update","type","fallback","isRdfaAttrs","rdfaNodeType","properties","prefLabelProps","filter","prop","object","termType","SKOS","matches","predicate","value","typeProp","RDF","getRDFFragment","backlinks","block_rdfa"],"mappings":";;;;;;;;AAoBA,MAAMA,cAAc,GAAG,aAAa;AAW7B,MAAMC,mBAAqD,GAAGA,CAAC;AACpEC,EAAAA,SAAS,GAAG,KAAK;AACjBC,EAAAA,eAAe,GAAG;AACpB,CAAC,GAAG,EAAE,KAAK;EACT,OAAO;AACLC,IAAAA,OAAO,EAAE,QAAQ;AACjBC,IAAAA,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AAC;IACD,IAAIP,cAAc,CAAC1C,MAAM,EAAE;AACzB,MAAA,OAAO0C,cAAc,CAAC,CAAC,CAAC,CAACG,MAAM,CAACK,KAAK;AACvC,IAAA,CAAC,MAAM;MACL,MAAMC,QAAQ,GAAGV,UAAU,CAAC5C,IAAI,CAC7B+C,IAAI,IACHA,IAAI,CAACC,MAAM,CAACC,QAAQ,KAAK,WAAW,IACpCM,GAAG,CAAC,MAAM,CAAC,CAACJ,OAAO,CAACJ,IAAI,CAACK,SAAS,CACtC,CAAC;AACD,MAAA,IAAIE,QAAQ,EAAE;AACZ,QAAA,OAAOE,cAAc,CAACF,QAAQ,CAACN,MAAM,CAACK,KAAK,CAAC;AAC9C,MAAA,CAAC,MAAM;AACL,QAAA,OAAOZ,QAAQ;AACjB,MAAA;AACF,IAAA;AACF,EAAA,CAAC,MAAM;IACL,MAAM;AAAEgB,MAAAA;AAAU,KAAC,GAAG1E,KAAK;IAC3B,IAAI0E,SAAS,CAACtD,MAAM,EAAE;MACpB,OAAOqD,cAAc,CAACC,SAAS,CAAC,CAAC,CAAC,CAACL,SAAS,CAAC;AAC/C,IAAA,CAAC,MAAM;AACL,MAAA,OAAOX,QAAQ;AACjB,IAAA;AACF,EAAA;AACF;;AAEA;AACA;AACA;AACO,MAAMiB,UAAU,GAAGhF,mBAAmB;;;;"}
|
|
1
|
+
{"version":3,"file":"block-rdfa.js","sources":["../../src/nodes/block-rdfa.ts"],"sourcesContent":["import { Node as PNode } from 'prosemirror-model';\nimport {\n isRdfaAttrs,\n type ModelMigrationGenerator,\n} from '#root/core/rdfa-types.ts';\nimport {\n getRdfaAttrs,\n rdfaAttrSpec,\n renderRdfaAware,\n} from '#root/core/schema.ts';\nimport type SayNodeSpec from '../core/say-node-spec.ts';\nimport type { NodeView, NodeViewConstructor } from 'prosemirror-view';\nimport { RDF, SKOS } from '../utils/_private/namespaces.ts';\nimport { getRDFFragment } from '../utils/namespace.ts';\nimport getClassnamesFromNode from '../utils/get-classnames-from-node.ts';\nimport type SayController from '#root/core/say-controller.ts';\nimport { selectNodeByRdfaId } from '#root/commands/_private/rdfa-commands/select-node-by-rdfa-id.ts';\nimport {\n contentElementWithMigrations,\n getAttrsWithMigrations,\n} from '#root/core/schema/_private/migrations.ts';\n\nconst FALLBACK_LABEL = 'Data-object';\n\ntype Config = {\n rdfaAware?: boolean;\n /**\n * Migrations to apply to nodes parsed as block-rdfa, to modify the data model.\n * @returns false to use the default parsing or an object to define overrides\n **/\n modelMigrations?: ModelMigrationGenerator[];\n};\n\nexport const blockRdfaWithConfig: (config?: Config) => SayNodeSpec = ({\n rdfaAware = false,\n modelMigrations = [],\n} = {}) => {\n return {\n content: 'block+',\n group: 'block',\n attrs: {\n ...rdfaAttrSpec({ rdfaAware }),\n label: {\n default: undefined,\n editable: true,\n },\n },\n definingAsContext: true,\n editable: rdfaAware,\n isolating: rdfaAware,\n selectable: rdfaAware,\n classNames: ['say-block-rdfa'],\n parseDOM: [\n {\n tag: `p, div, address, article, aside, blockquote, details, dialog, dd, dt, fieldset, figcaption, figure, footer, form, header, hgroup, hr, main, nav, pre, section`,\n // Default priority is 50, so this means a more specific definition matches before this one\n priority: 40,\n getAttrs(element: string | HTMLElement) {\n if (typeof element === 'string') {\n return false;\n }\n let attrs = getRdfaAttrs(element, { rdfaAware });\n if (attrs) {\n attrs = {\n ...attrs,\n label: element.dataset['label'] ?? attrs['label'],\n };\n return getAttrsWithMigrations(modelMigrations, attrs, element);\n }\n return false;\n },\n contentElement: (element) => {\n return contentElementWithMigrations(\n modelMigrations,\n rdfaAware,\n element,\n );\n },\n },\n ],\n toDOM(node: PNode) {\n if (rdfaAware) {\n return renderRdfaAware({\n renderable: node,\n tag: 'div',\n attrs: {\n class: `say-editable ${getClassnamesFromNode(node)}`,\n 'data-label': node.attrs['label'] as string,\n },\n content: 0,\n });\n } else {\n const { label, ...attrs } = node.attrs;\n return [\n 'div',\n {\n ...attrs,\n 'data-label': label as string,\n class: getClassnamesFromNode(node),\n },\n 0,\n ];\n }\n },\n };\n};\n\nexport class BlockRDFaView implements NodeView {\n dom: HTMLElement;\n labelElement: HTMLElement;\n contentDOM: HTMLElement;\n node: PNode;\n controller?: SayController;\n onClickRef: () => void;\n\n /**\n * @deprecated The SayController should now be passed to this nodeview to allow focusing nodes on\n * label clicks\n */\n constructor(node: PNode);\n constructor(\n nodeViewArgs: Parameters<NodeViewConstructor>,\n controller: SayController,\n );\n constructor(\n nodeViewArgs: Parameters<NodeViewConstructor> | PNode,\n controller?: SayController,\n ) {\n this.node = Array.isArray(nodeViewArgs) ? nodeViewArgs[0] : nodeViewArgs;\n this.dom = document.createElement('div');\n this.dom.setAttribute('class', 'say-block-rdfa');\n this.labelElement = this.dom.appendChild(document.createElement('span'));\n this.labelElement.contentEditable = 'false';\n this.labelElement.textContent = getBlockRDFaLabel(\n this.node,\n FALLBACK_LABEL,\n ).toUpperCase();\n this.labelElement.setAttribute('class', 'say-block-rdfa--label');\n // Save a ref to an arrow function as we can't use class methods directly here\n this.onClickRef = () => this.onClick();\n this.labelElement.addEventListener('click', this.onClickRef);\n this.controller = controller;\n this.contentDOM = this.dom.appendChild(document.createElement('div'));\n }\n\n destroy() {\n removeEventListener('click', this.onClickRef);\n }\n\n onClick() {\n if (this.controller) {\n this.controller.doCommand(\n selectNodeByRdfaId({\n rdfaId: this.node.attrs['__rdfaId'] as string,\n dontScroll: true,\n }),\n {\n view: this.controller.mainEditorView,\n },\n );\n }\n }\n\n update(node: PNode) {\n if (node.type != this.node.type) {\n return false;\n }\n this.node = node;\n this.labelElement.textContent = getBlockRDFaLabel(\n node,\n FALLBACK_LABEL,\n ).toUpperCase();\n return true;\n }\n}\n\n/**\n * Function that determines which label should be shown on the `block_rdfa` node\n * Priority:\n * 1. The `label` attribute\n * 2. Value of first encountered `skos:prefLabel` attribute (if resource node)\n * 3. Last part of the first encountered type/predicate URI\n * 4. The value of the `fallback` argument\n */\nfunction getBlockRDFaLabel(node: PNode, fallback: string) {\n const { attrs } = node;\n if (attrs['label']) {\n return attrs['label'] as string;\n }\n // Node is not rdfa-aware\n if (!isRdfaAttrs(attrs)) {\n return 'Data-object';\n }\n\n const { rdfaNodeType } = attrs;\n if (rdfaNodeType === 'resource') {\n const { properties } = attrs;\n const prefLabelProps = properties.filter(\n (prop) =>\n prop.object.termType === 'Literal' &&\n SKOS('prefLabel').matches(prop.predicate),\n );\n if (prefLabelProps.length) {\n return prefLabelProps[0].object.value;\n } else {\n const typeProp = properties.find(\n (prop) =>\n prop.object.termType === 'NamedNode' &&\n RDF('type').matches(prop.predicate),\n );\n if (typeProp) {\n return getRDFFragment(typeProp.object.value);\n } else {\n return fallback;\n }\n }\n } else {\n const { backlinks } = attrs;\n if (backlinks.length) {\n return getRDFFragment(backlinks[0].predicate);\n } else {\n return fallback;\n }\n }\n}\n\n/**\n * @deprecated use `blockRdfaWithConfig` instead\n */\nexport const block_rdfa = blockRdfaWithConfig();\n"],"names":["FALLBACK_LABEL","blockRdfaWithConfig","rdfaAware","modelMigrations","content","group","attrs","rdfaAttrSpec","label","default","undefined","editable","definingAsContext","isolating","selectable","classNames","parseDOM","tag","priority","getAttrs","element","getRdfaAttrs","dataset","getAttrsWithMigrations","contentElement","contentElementWithMigrations","toDOM","node","renderRdfaAware","renderable","class","getClassnamesFromNode","BlockRDFaView","dom","labelElement","contentDOM","controller","onClickRef","constructor","nodeViewArgs","Array","isArray","document","createElement","setAttribute","appendChild","contentEditable","textContent","getBlockRDFaLabel","toUpperCase","onClick","addEventListener","destroy","removeEventListener","doCommand","selectNodeByRdfaId","rdfaId","dontScroll","view","mainEditorView","update","type","fallback","isRdfaAttrs","rdfaNodeType","properties","prefLabelProps","filter","prop","object","termType","SKOS","matches","predicate","length","value","typeProp","find","RDF","getRDFFragment","backlinks","block_rdfa"],"mappings":";;;;;;;;;AAsBA,MAAMA,cAAc,GAAG,aAAa;AAW7B,MAAMC,mBAAqD,GAAGA,CAAC;AACpEC,EAAAA,SAAS,GAAG,KAAK;AACjBC,EAAAA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AA;AACF,IAAA;AACF,EAAA,CAAC,MAAM;IACL,MAAM;AAAEkB,MAAAA;AAAU,KAAC,GAAG1E,KAAK;IAC3B,IAAI0E,SAAS,CAACN,MAAM,EAAE;MACpB,OAAOK,cAAc,CAACC,SAAS,CAAC,CAAC,CAAC,CAACP,SAAS,CAAC;AAC/C,IAAA,CAAC,MAAM;AACL,MAAA,OAAOX,QAAQ;AACjB,IAAA;AACF,EAAA;AACF;;AAEA;AACA;AACA;AACO,MAAMmB,UAAU,GAAGhF,mBAAmB;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import 'prosemirror-model';
|
|
2
|
-
import { rdfaAttrSpec, getRdfaAttrs,
|
|
2
|
+
import { rdfaAttrSpec, getRdfaAttrs, renderRdfaAware } from '../core/schema.js';
|
|
3
3
|
import { createEmberNodeSpec, createEmberNodeView } from '../utils/_private/ember-node.js';
|
|
4
4
|
import InlineRdfaComponent from '../components/ember-node/inline-rdfa.js';
|
|
5
5
|
import getClassnamesFromNode from '../utils/get-classnames-from-node.js';
|
|
6
|
+
import { contentElementWithMigrations, getAttrsWithMigrations } from '../core/schema/_private/migrations.js';
|
|
6
7
|
|
|
7
8
|
const emberNodeConfig = ({
|
|
8
9
|
rdfaAware = false,
|
|
@@ -49,27 +50,12 @@ const emberNodeConfig = ({
|
|
|
49
50
|
rdfaAware
|
|
50
51
|
});
|
|
51
52
|
if (attrs) {
|
|
52
|
-
|
|
53
|
-
if (migration && migration.getAttrs) {
|
|
54
|
-
return migration.getAttrs(element);
|
|
55
|
-
}
|
|
56
|
-
return attrs;
|
|
53
|
+
return getAttrsWithMigrations(modelMigrations, attrs, element);
|
|
57
54
|
}
|
|
58
55
|
return false;
|
|
59
56
|
},
|
|
60
57
|
contentElement: element => {
|
|
61
|
-
|
|
62
|
-
const attrs = getRdfaAttrs(element, {
|
|
63
|
-
rdfaAware
|
|
64
|
-
});
|
|
65
|
-
if (attrs) {
|
|
66
|
-
const migration = modelMigrations.find(migration => migration(attrs))?.(attrs);
|
|
67
|
-
if (migration && migration.contentElement) {
|
|
68
|
-
return migration.contentElement(element);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return getRdfaContentElement(element);
|
|
58
|
+
return contentElementWithMigrations(modelMigrations, rdfaAware, element);
|
|
73
59
|
}
|
|
74
60
|
}],
|
|
75
61
|
attrs: rdfaAttrSpec({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-rdfa.js","sources":["../../src/nodes/inline-rdfa.ts"],"sourcesContent":["import { Node as PNode } from 'prosemirror-model';\nimport {
|
|
1
|
+
{"version":3,"file":"inline-rdfa.js","sources":["../../src/nodes/inline-rdfa.ts"],"sourcesContent":["import { Node as PNode } from 'prosemirror-model';\nimport { getRdfaAttrs, rdfaAttrSpec, renderRdfaAware } from '../core/schema.ts';\nimport {\n type EmberNodeConfig,\n createEmberNodeSpec,\n createEmberNodeView,\n} from '../utils/ember-node.ts';\nimport InlineRdfaComponent from '../components/ember-node/inline-rdfa.gts';\nimport type { ComponentLike } from '@glint/template';\nimport getClassnamesFromNode from '../utils/get-classnames-from-node.ts';\nimport type { ModelMigrationGenerator } from '#root/core/rdfa-types.ts';\nimport {\n contentElementWithMigrations,\n getAttrsWithMigrations,\n} from '#root/core/schema/_private/migrations.ts';\n\ntype Options = {\n rdfaAware?: boolean;\n /**\n * Migrations to apply to nodes parsed as inline-rdfa, to modify the data model.\n * @returns false to use the default parsing or an object to define overrides\n **/\n modelMigrations?: ModelMigrationGenerator[];\n};\n\nconst emberNodeConfig: (options?: Options) => EmberNodeConfig = ({\n rdfaAware = false,\n modelMigrations = [],\n} = {}) => {\n return {\n name: 'inline-rdfa',\n inline: true,\n component: InlineRdfaComponent as unknown as ComponentLike,\n group: 'inline',\n content: 'inline*',\n atom: true,\n draggable: false,\n selectable: true,\n editable: rdfaAware,\n isolating: rdfaAware,\n classNames: ['say-inline-rdfa'],\n toDOM(node: PNode) {\n if (rdfaAware) {\n return renderRdfaAware({\n renderable: node,\n tag: 'span',\n attrs: { class: getClassnamesFromNode(node) },\n content: 0,\n });\n } else {\n return [\n 'span',\n { ...node.attrs, class: getClassnamesFromNode(node) },\n 0,\n ];\n }\n },\n parseDOM: [\n {\n tag: 'span',\n // default prio is 50, highest prio comes first, and this parserule should at least come after all other nodes\n priority: 10,\n getAttrs(element: string | HTMLElement) {\n if (typeof element === 'string') {\n return false;\n }\n const attrs = getRdfaAttrs(element, { rdfaAware });\n if (attrs) {\n return getAttrsWithMigrations(modelMigrations, attrs, element);\n }\n return false;\n },\n contentElement: (element) => {\n return contentElementWithMigrations(\n modelMigrations,\n rdfaAware,\n element,\n );\n },\n },\n ],\n attrs: rdfaAttrSpec({ rdfaAware }),\n };\n};\n\nexport const inlineRdfaWithConfig = (options?: Options) =>\n createEmberNodeSpec(emberNodeConfig(options));\n\nexport const inlineRdfaWithConfigView = (options?: Options) =>\n createEmberNodeView(emberNodeConfig(options));\n"],"names":["emberNodeConfig","rdfaAware","modelMigrations","name","inline","component","InlineRdfaComponent","group","content","atom","draggable","selectable","editable","isolating","classNames","toDOM","node","renderRdfaAware","renderable","tag","attrs","class","getClassnamesFromNode","parseDOM","priority","getAttrs","element","getRdfaAttrs","getAttrsWithMigrations","contentElement","contentElementWithMigrations","rdfaAttrSpec","inlineRdfaWithConfig","options","createEmberNodeSpec","inlineRdfaWithConfigView","createEmberNodeView"],"mappings":";;;;;;;AAyBA,MAAMA,eAAuD,GAAGA,CAAC;AAC/DC,EAAAA,SAAS,GAAG,KAAK;AACjBC,EAAAA,eAAe,GAAG;AACpB,CAAC,GAAG,EAAE,KAAK;EACT,OAAO;AACLC,IAAAA,IAAI,EAAE,aAAa;AACnBC,IAAAA,MAAM,EAAE,IAAI;AACZC,IAAAA,SAAS,EAAEC,mBAA+C;AAC1DC,IAAAA,KAAK,EAAE,QAAQ;AACfC,IAAAA,OAAO,EAAE,SAAS;AAClBC,IAAAA,IAAI,EAAE,IAAI;AACVC,I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CAAC;AAAE9B,MAAAA;KAAW;GAClC;AACH,CAAC;AAEM,MAAM+B,oBAAoB,GAAIC,OAAiB,IACpDC,mBAAmB,CAAClC,eAAe,CAACiC,OAAO,CAAC;AAEvC,MAAME,wBAAwB,GAAIF,OAAiB,IACxDG,mBAAmB,CAACpC,eAAe,CAACiC,OAAO,CAAC;;;;"}
|
|
@@ -12,9 +12,11 @@ import 'iter-tools';
|
|
|
12
12
|
import { rdfaAttrSpec, renderRdfaAttrs, renderInvisibleRdfa, getRdfaAttrs } from '../core/schema.js';
|
|
13
13
|
import getClassnamesFromNode from '../utils/get-classnames-from-node.js';
|
|
14
14
|
import 'prosemirror-state';
|
|
15
|
+
import { contentElementWithMigrations, getAttrsWithMigrations } from '../core/schema/_private/migrations.js';
|
|
15
16
|
|
|
16
17
|
const invisibleRdfaWithConfig = ({
|
|
17
|
-
rdfaAware = false
|
|
18
|
+
rdfaAware = false,
|
|
19
|
+
modelMigrations = []
|
|
18
20
|
} = {}) => {
|
|
19
21
|
return {
|
|
20
22
|
inline: true,
|
|
@@ -33,22 +35,26 @@ const invisibleRdfaWithConfig = ({
|
|
|
33
35
|
},
|
|
34
36
|
parseDOM: [{
|
|
35
37
|
tag: 'span, link',
|
|
36
|
-
getAttrs(
|
|
37
|
-
if (typeof
|
|
38
|
+
getAttrs(element) {
|
|
39
|
+
if (typeof element === 'string') {
|
|
38
40
|
return false;
|
|
39
41
|
}
|
|
40
|
-
if (!
|
|
41
|
-
|
|
42
|
+
if (!element.hasChildNodes()) {
|
|
43
|
+
let attrs = getRdfaAttrs(element, {
|
|
42
44
|
rdfaAware
|
|
43
45
|
});
|
|
44
46
|
if (attrs) {
|
|
45
|
-
|
|
47
|
+
attrs = {
|
|
46
48
|
...attrs,
|
|
47
|
-
__tag: tagName(
|
|
49
|
+
__tag: tagName(element)
|
|
48
50
|
};
|
|
51
|
+
return getAttrsWithMigrations(modelMigrations, attrs, element);
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
return false;
|
|
55
|
+
},
|
|
56
|
+
contentElement: element => {
|
|
57
|
+
return contentElementWithMigrations(modelMigrations, rdfaAware, element);
|
|
52
58
|
}
|
|
53
59
|
}],
|
|
54
60
|
toDOM(node) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invisible-rdfa.js","sources":["../../src/nodes/invisible-rdfa.ts"],"sourcesContent":["import { tagName } from '#root/utils/_private/dom-helpers.ts';\nimport type SayNodeSpec from '../core/say-node-spec.ts';\nimport { type RdfaAttrs
|
|
1
|
+
{"version":3,"file":"invisible-rdfa.js","sources":["../../src/nodes/invisible-rdfa.ts"],"sourcesContent":["import { tagName } from '#root/utils/_private/dom-helpers.ts';\nimport type SayNodeSpec from '../core/say-node-spec.ts';\nimport {\n type ModelMigrationGenerator,\n type RdfaAttrs,\n} from '../core/rdfa-types.ts';\nimport {\n getRdfaAttrs,\n rdfaAttrSpec,\n renderInvisibleRdfa,\n renderRdfaAttrs,\n} from '../core/schema.ts';\nimport getClassnamesFromNode from '../utils/get-classnames-from-node.ts';\nimport { PNode } from '#root/prosemirror-aliases.ts';\nimport {\n contentElementWithMigrations,\n getAttrsWithMigrations,\n} from '#root/core/schema/_private/migrations.ts';\n\ntype Options = {\n rdfaAware?: boolean;\n /**\n * Migrations to apply to nodes parsed as block-rdfa, to modify the data model.\n * @returns false to use the default parsing or an object to define overrides\n **/\n modelMigrations?: ModelMigrationGenerator[];\n};\n\nexport const invisibleRdfaWithConfig: (options?: Options) => SayNodeSpec = ({\n rdfaAware = false,\n modelMigrations = [],\n} = {}) => {\n return {\n inline: true,\n group: 'inline',\n atom: true,\n defining: true,\n isolating: true,\n classNames: ['say-invisible-rdfa'],\n attrs: {\n ...rdfaAttrSpec({ rdfaAware }),\n __tag: { default: 'span' },\n },\n parseDOM: [\n {\n tag: 'span, link',\n getAttrs(element: string | HTMLElement) {\n if (typeof element === 'string') {\n return false;\n }\n if (!element.hasChildNodes()) {\n let attrs = getRdfaAttrs(element, { rdfaAware });\n if (attrs) {\n attrs = {\n ...attrs,\n __tag: tagName(element),\n };\n return getAttrsWithMigrations(modelMigrations, attrs, element);\n }\n }\n return false;\n },\n contentElement: (element) => {\n return contentElementWithMigrations(\n modelMigrations,\n rdfaAware,\n element,\n );\n },\n },\n ],\n toDOM(node: PNode) {\n const { __tag, ...attrs } = node.attrs;\n if (rdfaAware) {\n return [\n __tag,\n {\n ...renderRdfaAttrs(attrs as RdfaAttrs),\n class: getClassnamesFromNode(node),\n },\n renderInvisibleRdfa(node, 'span'),\n ];\n } else {\n return [__tag, attrs];\n }\n },\n };\n};\n\n/**\n * @deprecated use `invisibleRdfaWithConfig` instead\n */\nexport const invisible_rdfa = invisibleRdfaWithConfig();\n"],"names":["invisibleRdfaWithConfig","rdfaAware","modelMigrations","inline","group","atom","defining","isolating","classNames","attrs","rdfaAttrSpec","__tag","default","parseDOM","tag","getAttrs","element","hasChildNodes","getRdfaAttrs","tagName","getAttrsWithMigrations","contentElement","contentElementWithMigrations","toDOM","node","renderRdfaAttrs","class","getClassnamesFromNode","renderInvisibleRdfa","invisible_rdfa"],"mappings":";;;;;;;;;;;;;;;;AA4BO,MAAMA,uBAA2D,GAAGA,CAAC;AAC1EC,EAAAA,SAAS,GAAG,KAAK;AACjBC,EAAAA,eAAe,GAAG;AACpB,CAAC,GAAG,EAAE,KAAK;EACT,OAAO;AACLC,IAAAA,MAAM,EAAE,IAAI;AACZC,IAAAA,KAAK,EAAE,QAAQ;AACfC,IAAAA,IAAI,EAAE,IAAI;AACVC,IAAAA,QAAQ,EAAE,IAAI;AACdC,IAAAA,SAAS,EAAE,IAAI;IACfC,UAAU,EAAE,CAAC,oBAAoB,CAAC;AAClCC,IAAAA,KAAK,EAAE;AACL,MAAA,GAAGC,YAAY,CAAC;AAAET,QAAAA;AAAU,OAAC,CAAC;AAC9BU,MAAAA,KAAK,EAAE;AAAEC,QAAAA,OAAO,EAAE;AAAO;KAC1B;AACDC,IAAAA,QAAQ,EAAE,CACR;A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