@soomo/react-text-annotator 3.0.0-staging.7 → 3.0.0-staging.9
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/TextAnnotatorPopup.d.ts +5 -4
- package/dist/TextAnnotatorPopup.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/react-text-annotator.es10.js +565 -34
- package/dist/react-text-annotator.es10.js.map +1 -1
- package/dist/react-text-annotator.es11.js +460 -856
- package/dist/react-text-annotator.es11.js.map +1 -1
- package/dist/react-text-annotator.es12.js +2 -2
- package/dist/react-text-annotator.es13.js +35 -2
- package/dist/react-text-annotator.es13.js.map +1 -1
- package/dist/react-text-annotator.es14.js +894 -109
- package/dist/react-text-annotator.es14.js.map +1 -1
- package/dist/react-text-annotator.es15.js +208 -289
- package/dist/react-text-annotator.es15.js.map +1 -1
- package/dist/react-text-annotator.es16.js +127 -49
- package/dist/react-text-annotator.es16.js.map +1 -1
- package/dist/react-text-annotator.es17.js +113 -19
- package/dist/react-text-annotator.es17.js.map +1 -1
- package/dist/react-text-annotator.es18.js +312 -0
- package/dist/react-text-annotator.es18.js.map +1 -0
- package/dist/react-text-annotator.es19.js +61 -0
- package/dist/react-text-annotator.es19.js.map +1 -0
- package/dist/react-text-annotator.es2.js +1 -1
- package/dist/react-text-annotator.es20.js +23 -0
- package/dist/react-text-annotator.es20.js.map +1 -0
- package/dist/react-text-annotator.es21.js +5 -0
- package/dist/react-text-annotator.es21.js.map +1 -0
- package/dist/react-text-annotator.es22.js +5 -0
- package/dist/react-text-annotator.es22.js.map +1 -0
- package/dist/react-text-annotator.es23.js +124 -0
- package/dist/react-text-annotator.es23.js.map +1 -0
- package/dist/react-text-annotator.es24.js +555 -0
- package/dist/react-text-annotator.es24.js.map +1 -0
- package/dist/react-text-annotator.es4.js.map +1 -1
- package/dist/react-text-annotator.es5.js +60 -36
- package/dist/react-text-annotator.es5.js.map +1 -1
- package/dist/react-text-annotator.es6.js +3 -3
- package/dist/react-text-annotator.es8.js +24 -488
- package/dist/react-text-annotator.es8.js.map +1 -1
- package/dist/react-text-annotator.es9.js +196 -2
- package/dist/react-text-annotator.es9.js.map +1 -1
- package/dist/utils.d.ts +14 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +4 -3
|
@@ -1,61 +1,139 @@
|
|
|
1
|
-
function
|
|
2
|
-
if (
|
|
3
|
-
|
|
4
|
-
if (!this.namespaces.has(bhvs.namespaces[prefix]) && !Array.from(this.namespaces.values()).includes(prefix)) {
|
|
5
|
-
this.namespaces.set(bhvs.namespaces[prefix], prefix);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
function getNodeName(node) {
|
|
2
|
+
if (isNode(node)) {
|
|
3
|
+
return (node.nodeName || "").toLowerCase();
|
|
8
4
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
return "#document";
|
|
6
|
+
}
|
|
7
|
+
function getWindow(node) {
|
|
8
|
+
var _node$ownerDocument;
|
|
9
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
10
|
+
}
|
|
11
|
+
function getDocumentElement(node) {
|
|
12
|
+
var _ref;
|
|
13
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
14
|
+
}
|
|
15
|
+
function isNode(value) {
|
|
16
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
17
|
+
}
|
|
18
|
+
function isElement(value) {
|
|
19
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
20
|
+
}
|
|
21
|
+
function isHTMLElement(value) {
|
|
22
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
23
|
+
}
|
|
24
|
+
function isShadowRoot(value) {
|
|
25
|
+
if (typeof ShadowRoot === "undefined") {
|
|
26
|
+
return false;
|
|
15
27
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
28
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
29
|
+
}
|
|
30
|
+
function isOverflowElement(element) {
|
|
31
|
+
const {
|
|
32
|
+
overflow,
|
|
33
|
+
overflowX,
|
|
34
|
+
overflowY,
|
|
35
|
+
display
|
|
36
|
+
} = getComputedStyle(element);
|
|
37
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
38
|
+
}
|
|
39
|
+
function isTableElement(element) {
|
|
40
|
+
return ["table", "td", "th"].includes(getNodeName(element));
|
|
41
|
+
}
|
|
42
|
+
function isContainingBlock(element) {
|
|
43
|
+
const webkit = isWebKit();
|
|
44
|
+
const css = getComputedStyle(element);
|
|
45
|
+
return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
|
|
46
|
+
}
|
|
47
|
+
function getContainingBlock(element) {
|
|
48
|
+
let currentNode = getParentNode(element);
|
|
49
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
50
|
+
if (isContainingBlock(currentNode)) {
|
|
51
|
+
return currentNode;
|
|
19
52
|
}
|
|
53
|
+
currentNode = getParentNode(currentNode);
|
|
20
54
|
}
|
|
21
|
-
|
|
22
|
-
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
function isWebKit() {
|
|
58
|
+
if (typeof CSS === "undefined" || !CSS.supports)
|
|
59
|
+
return false;
|
|
60
|
+
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
61
|
+
}
|
|
62
|
+
function isLastTraversableNode(node) {
|
|
63
|
+
return ["html", "body", "#document"].includes(getNodeName(node));
|
|
64
|
+
}
|
|
65
|
+
function getComputedStyle(element) {
|
|
66
|
+
return getWindow(element).getComputedStyle(element);
|
|
67
|
+
}
|
|
68
|
+
function getNodeScroll(element) {
|
|
69
|
+
if (isElement(element)) {
|
|
70
|
+
return {
|
|
71
|
+
scrollLeft: element.scrollLeft,
|
|
72
|
+
scrollTop: element.scrollTop
|
|
73
|
+
};
|
|
23
74
|
}
|
|
24
|
-
|
|
25
|
-
|
|
75
|
+
return {
|
|
76
|
+
scrollLeft: element.pageXOffset,
|
|
77
|
+
scrollTop: element.pageYOffset
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function getParentNode(node) {
|
|
81
|
+
if (getNodeName(node) === "html") {
|
|
82
|
+
return node;
|
|
26
83
|
}
|
|
84
|
+
const result = (
|
|
85
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
86
|
+
node.assignedSlot || // DOM Element detected.
|
|
87
|
+
node.parentNode || // ShadowRoot detected.
|
|
88
|
+
isShadowRoot(node) && node.host || // Fallback.
|
|
89
|
+
getDocumentElement(node)
|
|
90
|
+
);
|
|
91
|
+
return isShadowRoot(result) ? result.host : result;
|
|
27
92
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} else {
|
|
52
|
-
p = ns;
|
|
93
|
+
function getNearestOverflowAncestor(node) {
|
|
94
|
+
const parentNode = getParentNode(node);
|
|
95
|
+
if (isLastTraversableNode(parentNode)) {
|
|
96
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
97
|
+
}
|
|
98
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
99
|
+
return parentNode;
|
|
100
|
+
}
|
|
101
|
+
return getNearestOverflowAncestor(parentNode);
|
|
102
|
+
}
|
|
103
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
104
|
+
var _node$ownerDocument2;
|
|
105
|
+
if (list === void 0) {
|
|
106
|
+
list = [];
|
|
107
|
+
}
|
|
108
|
+
if (traverseIframes === void 0) {
|
|
109
|
+
traverseIframes = true;
|
|
110
|
+
}
|
|
111
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
112
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
113
|
+
const win = getWindow(scrollableAncestor);
|
|
114
|
+
if (isBody) {
|
|
115
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
|
|
53
116
|
}
|
|
54
|
-
|
|
117
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
55
118
|
}
|
|
56
119
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
120
|
+
getComputedStyle,
|
|
121
|
+
getContainingBlock,
|
|
122
|
+
getDocumentElement,
|
|
123
|
+
getNearestOverflowAncestor,
|
|
124
|
+
getNodeName,
|
|
125
|
+
getNodeScroll,
|
|
126
|
+
getOverflowAncestors,
|
|
127
|
+
getParentNode,
|
|
128
|
+
getWindow,
|
|
129
|
+
isContainingBlock,
|
|
130
|
+
isElement,
|
|
131
|
+
isHTMLElement,
|
|
132
|
+
isLastTraversableNode,
|
|
133
|
+
isNode,
|
|
134
|
+
isOverflowElement,
|
|
135
|
+
isShadowRoot,
|
|
136
|
+
isTableElement,
|
|
137
|
+
isWebKit
|
|
60
138
|
};
|
|
61
139
|
//# sourceMappingURL=react-text-annotator.es16.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-text-annotator.es16.js","sources":["../../../node_modules/
|
|
1
|
+
{"version":3,"file":"react-text-annotator.es16.js","sources":["../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs"],"sourcesContent":["function getNodeName(node) {\n if (isNode(node)) {\n return (node.nodeName || '').toLowerCase();\n }\n // Mocked nodes in testing environments may not be instances of Node. By\n // returning `#document` an infinite loop won't occur.\n // https://github.com/floating-ui/floating-ui/issues/2317\n return '#document';\n}\nfunction getWindow(node) {\n var _node$ownerDocument;\n return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;\n}\nfunction getDocumentElement(node) {\n var _ref;\n return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;\n}\nfunction isNode(value) {\n return value instanceof Node || value instanceof getWindow(value).Node;\n}\nfunction isElement(value) {\n return value instanceof Element || value instanceof getWindow(value).Element;\n}\nfunction isHTMLElement(value) {\n return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;\n}\nfunction isShadowRoot(value) {\n // Browsers without `ShadowRoot` support.\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;\n}\nfunction isOverflowElement(element) {\n const {\n overflow,\n overflowX,\n overflowY,\n display\n } = getComputedStyle(element);\n return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);\n}\nfunction isTableElement(element) {\n return ['table', 'td', 'th'].includes(getNodeName(element));\n}\nfunction isContainingBlock(element) {\n const webkit = isWebKit();\n const css = getComputedStyle(element);\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));\n}\nfunction getContainingBlock(element) {\n let currentNode = getParentNode(element);\n while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {\n if (isContainingBlock(currentNode)) {\n return currentNode;\n }\n currentNode = getParentNode(currentNode);\n }\n return null;\n}\nfunction isWebKit() {\n if (typeof CSS === 'undefined' || !CSS.supports) return false;\n return CSS.supports('-webkit-backdrop-filter', 'none');\n}\nfunction isLastTraversableNode(node) {\n return ['html', 'body', '#document'].includes(getNodeName(node));\n}\nfunction getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}\nfunction getNodeScroll(element) {\n if (isElement(element)) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n }\n return {\n scrollLeft: element.pageXOffset,\n scrollTop: element.pageYOffset\n };\n}\nfunction getParentNode(node) {\n if (getNodeName(node) === 'html') {\n return node;\n }\n const result =\n // Step into the shadow DOM of the parent of a slotted node.\n node.assignedSlot ||\n // DOM Element detected.\n node.parentNode ||\n // ShadowRoot detected.\n isShadowRoot(node) && node.host ||\n // Fallback.\n getDocumentElement(node);\n return isShadowRoot(result) ? result.host : result;\n}\nfunction getNearestOverflowAncestor(node) {\n const parentNode = getParentNode(node);\n if (isLastTraversableNode(parentNode)) {\n return node.ownerDocument ? node.ownerDocument.body : node.body;\n }\n if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {\n return parentNode;\n }\n return getNearestOverflowAncestor(parentNode);\n}\nfunction getOverflowAncestors(node, list, traverseIframes) {\n var _node$ownerDocument2;\n if (list === void 0) {\n list = [];\n }\n if (traverseIframes === void 0) {\n traverseIframes = true;\n }\n const scrollableAncestor = getNearestOverflowAncestor(node);\n const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);\n const win = getWindow(scrollableAncestor);\n if (isBody) {\n return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);\n }\n return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));\n}\n\nexport { getComputedStyle, getContainingBlock, getDocumentElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isWebKit };\n"],"names":[],"mappings":"AAAA,SAAS,YAAY,MAAM;AACzB,MAAI,OAAO,IAAI,GAAG;AAChB,YAAQ,KAAK,YAAY,IAAI,YAAW;AAAA,EACzC;AAID,SAAO;AACT;AACA,SAAS,UAAU,MAAM;AACvB,MAAI;AACJ,UAAQ,QAAQ,SAAS,sBAAsB,KAAK,kBAAkB,OAAO,SAAS,oBAAoB,gBAAgB;AAC5H;AACA,SAAS,mBAAmB,MAAM;AAChC,MAAI;AACJ,UAAQ,QAAQ,OAAO,IAAI,IAAI,KAAK,gBAAgB,KAAK,aAAa,OAAO,aAAa,OAAO,SAAS,KAAK;AACjH;AACA,SAAS,OAAO,OAAO;AACrB,SAAO,iBAAiB,QAAQ,iBAAiB,UAAU,KAAK,EAAE;AACpE;AACA,SAAS,UAAU,OAAO;AACxB,SAAO,iBAAiB,WAAW,iBAAiB,UAAU,KAAK,EAAE;AACvE;AACA,SAAS,cAAc,OAAO;AAC5B,SAAO,iBAAiB,eAAe,iBAAiB,UAAU,KAAK,EAAE;AAC3E;AACA,SAAS,aAAa,OAAO;AAE3B,MAAI,OAAO,eAAe,aAAa;AACrC,WAAO;AAAA,EACR;AACD,SAAO,iBAAiB,cAAc,iBAAiB,UAAU,KAAK,EAAE;AAC1E;AACA,SAAS,kBAAkB,SAAS;AAClC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,IAAM,i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ignoreList":[0]}
|
|
@@ -1,23 +1,117 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const defaultBehaviors = {
|
|
2
|
+
"namespaces": {
|
|
3
|
+
"tei": "http://www.tei-c.org/ns/1.0",
|
|
4
|
+
"teieg": "http://www.tei-c.org/ns/Examples",
|
|
5
|
+
"rng": "http://relaxng.org/ns/structure/1.0"
|
|
6
|
+
},
|
|
7
|
+
"tei": {
|
|
8
|
+
"eg": ["<pre>", "</pre>"],
|
|
9
|
+
// inserts a link inside <ptr> using the @target; the link in the
|
|
10
|
+
// @href is piped through the rw (rewrite) function before insertion
|
|
11
|
+
"ptr": ['<a href="$rw@target">$@target</a>'],
|
|
12
|
+
// wraps the content of the <ref> in an HTML link with the @target in
|
|
13
|
+
// the @href. If there are multiple @targets, only the first is used.
|
|
14
|
+
"ref": [
|
|
15
|
+
["[target]", ['<a href="$rw@target">', "</a>"]]
|
|
16
|
+
],
|
|
17
|
+
// creates an img tag with the @url as the src attribute
|
|
18
|
+
"graphic": function(elt) {
|
|
19
|
+
let content = new Image();
|
|
20
|
+
content.src = this.rw(elt.getAttribute("url"));
|
|
21
|
+
if (elt.hasAttribute("width")) {
|
|
22
|
+
content.setAttribute("width", elt.getAttribute("width"));
|
|
23
|
+
}
|
|
24
|
+
if (elt.hasAttribute("height")) {
|
|
25
|
+
content.setAttribute("height", elt.getAttribute("height"));
|
|
26
|
+
}
|
|
27
|
+
return content;
|
|
28
|
+
},
|
|
29
|
+
"list": [
|
|
30
|
+
// will only run on a list where @type="gloss"
|
|
31
|
+
[
|
|
32
|
+
"[type=gloss]",
|
|
33
|
+
function(elt) {
|
|
34
|
+
const doc = elt.ownerDocument;
|
|
35
|
+
let dl = doc.createElement("dl");
|
|
36
|
+
for (let child of Array.from(elt.children)) {
|
|
37
|
+
if (child.nodeType == 1) {
|
|
38
|
+
if (child.localName == "tei-label") {
|
|
39
|
+
let dt = doc.createElement("dt");
|
|
40
|
+
dt.innerHTML = child.innerHTML;
|
|
41
|
+
dl.appendChild(dt);
|
|
42
|
+
}
|
|
43
|
+
if (child.localName == "tei-item") {
|
|
44
|
+
let dd = doc.createElement("dd");
|
|
45
|
+
dd.innerHTML = child.innerHTML;
|
|
46
|
+
dl.appendChild(dd);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return dl;
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
],
|
|
54
|
+
"note": [
|
|
55
|
+
// Make endnotes
|
|
56
|
+
["[place=end]", function(elt) {
|
|
57
|
+
const doc = elt.ownerDocument;
|
|
58
|
+
if (!this.noteIndex) {
|
|
59
|
+
this["noteIndex"] = 1;
|
|
60
|
+
} else {
|
|
61
|
+
this.noteIndex++;
|
|
62
|
+
}
|
|
63
|
+
let id = "_note_" + this.noteIndex;
|
|
64
|
+
let link = doc.createElement("a");
|
|
65
|
+
link.setAttribute("id", "src" + id);
|
|
66
|
+
link.setAttribute("href", "#" + id);
|
|
67
|
+
link.innerHTML = this.noteIndex;
|
|
68
|
+
let content = doc.createElement("sup");
|
|
69
|
+
content.appendChild(link);
|
|
70
|
+
let notes = doc.querySelector("ol.notes");
|
|
71
|
+
if (!notes) {
|
|
72
|
+
notes = doc.createElement("ol");
|
|
73
|
+
notes.setAttribute("class", "notes");
|
|
74
|
+
this.dom.appendChild(notes);
|
|
75
|
+
}
|
|
76
|
+
let note = doc.createElement("li");
|
|
77
|
+
note.id = id;
|
|
78
|
+
note.innerHTML = elt.innerHTML;
|
|
79
|
+
notes.appendChild(note);
|
|
80
|
+
return content;
|
|
81
|
+
}],
|
|
82
|
+
["_", ["(", ")"]]
|
|
83
|
+
],
|
|
84
|
+
// Hide the teiHeader by default
|
|
85
|
+
"teiHeader": function(e) {
|
|
86
|
+
this.hideContent(e, false);
|
|
87
|
+
},
|
|
88
|
+
// Make the title element the HTML title
|
|
89
|
+
"title": [
|
|
90
|
+
["tei-titlestmt>tei-title", function(elt) {
|
|
91
|
+
const doc = elt.ownerDocument;
|
|
92
|
+
let title = doc.createElement("title");
|
|
93
|
+
title.innerHTML = elt.innerText;
|
|
94
|
+
doc.querySelector("head").appendChild(title);
|
|
95
|
+
}]
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"teieg": {
|
|
99
|
+
"egXML": function(elt) {
|
|
100
|
+
const doc = elt.ownerDocument;
|
|
101
|
+
let pre = doc.createElement("pre");
|
|
102
|
+
let code = doc.createElement("code");
|
|
103
|
+
pre.appendChild(code);
|
|
104
|
+
let content = this.serialize(elt, true).replace(/</g, "<");
|
|
105
|
+
let ws = content.match(/^[\t ]+/);
|
|
106
|
+
if (ws) {
|
|
107
|
+
content = content.replace(new RegExp("^" + ws[0], "mg"), "");
|
|
108
|
+
}
|
|
109
|
+
code.innerHTML = content;
|
|
110
|
+
return pre;
|
|
7
111
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const els = new Set(
|
|
11
|
-
Array.from(root.querySelectorAll("*"), qname)
|
|
12
|
-
);
|
|
13
|
-
els.add(qname(root));
|
|
14
|
-
return els;
|
|
15
|
-
}
|
|
16
|
-
function learnCustomElementNames(HTML_dom) {
|
|
17
|
-
return new Set(Array.from(HTML_dom.querySelectorAll("*[data-origname]"), (e) => e.localName.replace(/(\w+)-.+/, "$1:") + e.getAttribute("data-origname")));
|
|
18
|
-
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
19
114
|
export {
|
|
20
|
-
|
|
21
|
-
learnElementNames
|
|
115
|
+
defaultBehaviors as default
|
|
22
116
|
};
|
|
23
117
|
//# sourceMappingURL=react-text-annotator.es17.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-text-annotator.es17.js","sources":["../../../node_modules/CETEIcean/src/
|
|
1
|
+
{"version":3,"file":"react-text-annotator.es17.js","sources":["../../../node_modules/CETEIcean/src/defaultBehaviors.js"],"sourcesContent":["export default {\n \"namespaces\": {\n \"tei\": \"http://www.tei-c.org/ns/1.0\",\n \"teieg\": \"http://www.tei-c.org/ns/Examples\",\n \"rng\": \"http://relaxng.org/ns/structure/1.0\" \n },\n \"tei\": {\n \"eg\": [\"<pre>\",\"</pre>\"],\n // inserts a link inside <ptr> using the @target; the link in the\n // @href is piped through the rw (rewrite) function before insertion\n \"ptr\": [\"<a href=\\\"$rw@target\\\">$@target</a>\"],\n // wraps the content of the <ref> in an HTML link with the @target in \n // the @href. If there are multiple @targets, only the first is used.\n \"ref\": [\n [\"[target]\", [\"<a href=\\\"$rw@target\\\">\",\"</a>\"]]\n ],\n // creates an img tag with the @url as the src attribute\n \"graphic\": function(elt) {\n let content = new Image();\n content.src = this.rw(elt.getAttribute(\"url\"));\n if (elt.hasAttribute(\"width\")) {\n content.setAttribute(\"width\",elt.getAttribute(\"width\"));\n }\n if (elt.hasAttribute(\"height\")) {\n content.setAttribute(\"height\",elt.getAttribute(\"height\"));\n }\n return content;\n },\n \"list\": [\n // will only run on a list where @type=\"gloss\"\n [\"[type=gloss]\", function(elt) {\n const doc = elt.ownerDocument;\n let dl = doc.createElement(\"dl\");\n for (let child of Array.from(elt.children)) {\n // nodeType 1 is Node.ELEMENT_NODE\n if (child.nodeType == 1) {\n if (child.localName == \"tei-label\") {\n let dt = doc.createElement(\"dt\");\n dt.innerHTML = child.innerHTML;\n dl.appendChild(dt);\n }\n if (child.localName == \"tei-item\") {\n let dd = doc.createElement(\"dd\");\n dd.innerHTML = child.innerHTML;\n dl.appendChild(dd);\n }\n }\n }\n return dl;\n }\n ]],\n \"note\": [\n // Make endnotes\n [\"[place=end]\", function(elt){\n const doc = elt.ownerDocument;\n if (!this.noteIndex){\n this[\"noteIndex\"] = 1;\n } else {\n this.noteIndex++;\n }\n let id = \"_note_\" + this.noteIndex;\n let link = doc.createElement(\"a\");\n link.setAttribute(\"id\", \"src\" + id);\n link.setAttribute(\"href\", \"#\" + id);\n link.innerHTML = this.noteIndex;\n let content = doc.createElement(\"sup\");\n content.appendChild(link);\n let notes = doc.querySelector(\"ol.notes\");\n if (!notes) {\n notes = doc.createElement(\"ol\");\n notes.setAttribute(\"class\", \"notes\");\n this.dom.appendChild(notes);\n }\n let note = doc.createElement(\"li\");\n note.id = id;\n note.innerHTML = elt.innerHTML;\n notes.appendChild(note);\n return content;\n }],\n [\"_\", [\"(\",\")\"]]\n ],\n // Hide the teiHeader by default\n \"teiHeader\": function(e) {\n this.hideContent(e, false);\n },\n // Make the title element the HTML title\n \"title\": [\n [\"tei-titlestmt>tei-title\", function(elt) {\n const doc = elt.ownerDocument;\n let title = doc.createElement(\"title\");\n title.innerHTML = elt.innerText;\n doc.querySelector(\"head\").appendChild(title);\n }]\n ],\n },\n \"teieg\": {\n \"egXML\": function(elt) {\n const doc = elt.ownerDocument;\n let pre = doc.createElement(\"pre\");\n let code = doc.createElement(\"code\");\n pre.appendChild(code);\n let content = this.serialize(elt, true).replace(/</g, \"<\");\n let ws = content.match(/^[\\t ]+/);\n if (ws) {\n content = content.replace(new RegExp(\"^\" + ws[0], \"mg\"), \"\");\n }\n code.innerHTML = content;\n return pre;\n }\n }\n}\n"],"names":[],"mappings":"AAAA,MAAe,mBAAA;AAAA,EACb,cAAc;AAAA,IACZ,OAAO;AAAA,IACP,SAAS;AAAA,IACT,OAAO;AAAA,EACR;AAAA,EACD,OAAO;AAAA,IACL,MAAM,CAAC,SAAQ,QAAQ;AAAA;AAAA;AAAA,IAGvB,OAAO,CAAC,mCAAqC;AAAA;AAAA;AAAA,IAG7C,OAAO;AAAA,MACL,CAAC,YAAY,CAAC,yBAA0B,MAAM,CAAC;AAAA,IAChD;AAAA;AAAA,IAED,WAAW,SAAS,KAAK;AACvB,UAAI,UAAU,IAAI;AAClB,cAAQ,MAAM,KAAK,GAAG,IAAI,aAAa,KAAK,CAAC;AAC7C,UAAI,IAAI,aAAa,OAAO,GAAG;AAC7B,gBAAQ,aAAa,SAAQ,IAAI,aAAa,OAAO,CAAC;AAAA,MACvD;AACD,U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