jodit 4.19.10 → 4.19.12
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/CHANGELOG.md +150 -131
- package/es2015/jodit.css +33 -1
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +10 -10
- package/es2015/jodit.js +781 -195
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +10 -10
- package/es2015/plugins/debug/debug.css +1 -1
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +10 -10
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +10 -10
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +33 -1
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +15 -15
- package/es2021/jodit.js +780 -193
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +15 -15
- package/es2021/plugins/debug/debug.css +1 -1
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +33 -1
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +22 -22
- package/es2021.en/jodit.js +780 -193
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +22 -22
- package/es2021.en/plugins/debug/debug.css +1 -1
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +34 -2
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +827 -200
- package/es5/jodit.min.css +3 -3
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/dom/dom.js +2 -2
- package/esm/core/helpers/checker/is-html-from-word.d.ts +4 -3
- package/esm/core/helpers/checker/is-html-from-word.js +94 -14
- package/esm/core/helpers/checker/is-html.d.ts +4 -0
- package/esm/core/helpers/checker/is-html.js +54 -2
- package/esm/core/helpers/html/apply-styles.js +20 -11
- package/esm/core/helpers/html/clean-from-word.js +2 -3
- package/esm/core/helpers/html/index.d.ts +1 -0
- package/esm/core/helpers/html/index.js +1 -0
- package/esm/core/helpers/html/tag-scan.d.ts +36 -0
- package/esm/core/helpers/html/tag-scan.js +257 -0
- package/esm/core/helpers/string/trim.d.ts +4 -0
- package/esm/core/helpers/string/trim.js +29 -10
- package/esm/core/selection/helpers/index.js +3 -2
- package/esm/core/ui/button/tooltip/tooltip.d.ts +6 -0
- package/esm/core/ui/button/tooltip/tooltip.js +14 -3
- package/esm/core/view/view-with-toolbar.js +6 -1
- package/esm/jodit.js +2 -1
- package/esm/plugins/add-new-line/add-new-line.d.ts +5 -0
- package/esm/plugins/add-new-line/add-new-line.js +20 -3
- package/esm/plugins/delete/delete.d.ts +7 -0
- package/esm/plugins/delete/delete.js +38 -2
- package/esm/plugins/hr/hr.js +5 -0
- package/esm/plugins/iframe/iframe.js +59 -12
- package/esm/plugins/media/media.js +10 -9
- package/esm/plugins/paste/helpers.js +4 -2
- package/esm/plugins/resizer/resizer.js +6 -5
- package/esm/plugins/select-cells/select-cells.d.ts +1 -0
- package/esm/plugins/select-cells/select-cells.js +12 -18
- package/package.json +1 -1
- package/types/core/helpers/checker/is-html-from-word.d.ts +4 -3
- package/types/core/helpers/checker/is-html.d.ts +4 -0
- package/types/core/helpers/html/index.d.ts +1 -0
- package/types/core/helpers/html/tag-scan.d.ts +36 -0
- package/types/core/helpers/string/trim.d.ts +4 -0
- package/types/core/ui/button/tooltip/tooltip.d.ts +6 -0
- package/types/plugins/add-new-line/add-new-line.d.ts +5 -0
- package/types/plugins/delete/delete.d.ts +7 -0
- package/types/plugins/select-cells/select-cells.d.ts +1 -0
package/es5/polyfills.fat.min.js
CHANGED
package/es5/polyfills.js
CHANGED
package/es5/polyfills.min.js
CHANGED
package/esm/core/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.19.
|
|
6
|
+
export const APP_VERSION = "4.19.12";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
package/esm/core/dom/dom.js
CHANGED
|
@@ -12,6 +12,7 @@ import { isHTML } from "../helpers/checker/is-html.js";
|
|
|
12
12
|
import { isSet } from "../helpers/checker/is-set.js";
|
|
13
13
|
import { isString } from "../helpers/checker/is-string.js";
|
|
14
14
|
import { isVoid } from "../helpers/checker/is-void.js";
|
|
15
|
+
import { unwrapMarkedTags } from "../helpers/html/tag-scan.js";
|
|
15
16
|
import { trim } from "../helpers/string/trim.js";
|
|
16
17
|
import { assert } from "../helpers/utils/assert.js";
|
|
17
18
|
import { attr } from "../helpers/utils/attr.js";
|
|
@@ -19,7 +20,6 @@ import { css } from "../helpers/utils/css.js";
|
|
|
19
20
|
import { dataBind } from "../helpers/utils/data-bind.js";
|
|
20
21
|
import { error } from "../helpers/utils/error/index.js";
|
|
21
22
|
import { call } from "../helpers/utils/utils.js";
|
|
22
|
-
const TEMP_ELEMENT_REG_EXP = new RegExp(`<([a-z]+)[^>]+${TEMP_ATTR}[^>]*>(.+?)</\\1>`, 'gi');
|
|
23
23
|
/**
|
|
24
24
|
* Module for working with DOM
|
|
25
25
|
*/
|
|
@@ -765,7 +765,7 @@ export class Dom {
|
|
|
765
765
|
* Unwrap temporary elements inside a HTML string (keeps their content)
|
|
766
766
|
*/
|
|
767
767
|
static replaceTemporaryFromString(value) {
|
|
768
|
-
return value
|
|
768
|
+
return unwrapMarkedTags(value, null, TEMP_ATTR);
|
|
769
769
|
}
|
|
770
770
|
/**
|
|
771
771
|
* Collect the temporary elements (`data-jodit-temp`) inside the root.
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* @module helpers/checker
|
|
8
|
-
*/
|
|
9
6
|
/**
|
|
10
7
|
* Detect if string is HTML from MS Word, Excel or LibreOffice/OpenOffice
|
|
8
|
+
*
|
|
9
|
+
* The clipboard text is attacker controlled, so every check walks the string
|
|
10
|
+
* once with `indexOf`: a regex with an unbounded group before a required
|
|
11
|
+
* literal was quadratic on a long run of `<meta` and froze the tab.
|
|
11
12
|
*/
|
|
12
13
|
export declare function isHtmlFromWord(data: string): boolean;
|
|
@@ -6,22 +6,102 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module helpers/checker
|
|
8
8
|
*/
|
|
9
|
+
const SPACE = /\s/;
|
|
10
|
+
const DIGIT = /\d/;
|
|
11
|
+
const WORD_CHAR = /\w/;
|
|
12
|
+
// `content="Microsoft Word 15"` — the name followed by a space and a version digit
|
|
13
|
+
function hasGenerator(tag, name) {
|
|
14
|
+
let index = tag.indexOf(name);
|
|
15
|
+
while (index !== -1) {
|
|
16
|
+
const after = index + name.length;
|
|
17
|
+
if (SPACE.test(tag.charAt(after)) &&
|
|
18
|
+
DIGIT.test(tag.charAt(after + 1))) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
index = tag.indexOf(name, after);
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
// `<meta name=ProgId content=Word.Document>`, `<meta name=Generator content="LibreOffice 7.6">`
|
|
26
|
+
function isOfficeMeta(tag) {
|
|
27
|
+
if (hasGenerator(tag, 'Microsoft Word') ||
|
|
28
|
+
hasGenerator(tag, 'Microsoft Excel')) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
const lower = tag.toLowerCase();
|
|
32
|
+
const progId = lower.indexOf('progid');
|
|
33
|
+
if (progId !== -1 &&
|
|
34
|
+
(lower.indexOf('word.', progId) !== -1 ||
|
|
35
|
+
lower.indexOf('excel.', progId) !== -1)) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
return lower.includes('libreoffice') || lower.includes('openoffice');
|
|
39
|
+
}
|
|
40
|
+
// ` class=MsoNormal`, ` class="MsoListParagraph"` inside one tag
|
|
41
|
+
function hasMsoClass(tag) {
|
|
42
|
+
let index = tag.indexOf('class=');
|
|
43
|
+
while (index !== -1) {
|
|
44
|
+
if (index > 0 && SPACE.test(tag.charAt(index - 1))) {
|
|
45
|
+
let value = index + 'class='.length;
|
|
46
|
+
const quote = tag.charAt(value);
|
|
47
|
+
if (quote === '"' || quote === "'") {
|
|
48
|
+
value += 1;
|
|
49
|
+
}
|
|
50
|
+
if (tag.startsWith('Mso', value)) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
index = tag.indexOf('class=', index + 'class='.length);
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
// `style='mso-list:l0 level1 lfo1'` — an `mso-` property inside a style attribute with the given quote
|
|
59
|
+
function hasMsoStyle(data, quote) {
|
|
60
|
+
const open = 'style=' + quote;
|
|
61
|
+
let index = data.indexOf(open);
|
|
62
|
+
while (index !== -1) {
|
|
63
|
+
const start = index + open.length;
|
|
64
|
+
let end = data.indexOf(quote, start);
|
|
65
|
+
if (end === -1) {
|
|
66
|
+
end = data.length;
|
|
67
|
+
}
|
|
68
|
+
if (data.slice(start, end).includes('mso-')) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
index = data.indexOf(open, end);
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
9
75
|
/**
|
|
10
76
|
* Detect if string is HTML from MS Word, Excel or LibreOffice/OpenOffice
|
|
77
|
+
*
|
|
78
|
+
* The clipboard text is attacker controlled, so every check walks the string
|
|
79
|
+
* once with `indexOf`: a regex with an unbounded group before a required
|
|
80
|
+
* literal was quadratic on a long run of `<meta` and froze the tab.
|
|
11
81
|
*/
|
|
12
82
|
export function isHtmlFromWord(data) {
|
|
13
|
-
|
|
14
|
-
data.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
83
|
+
if (data.includes('urn:schemas-microsoft-com:office:word') ||
|
|
84
|
+
data.includes('urn:schemas-microsoft-com:office:excel')) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
// Each tag is taken once, from its `<` to the next `>`, so the scan stays linear
|
|
88
|
+
let index = data.indexOf('<');
|
|
89
|
+
while (index !== -1) {
|
|
90
|
+
if (!WORD_CHAR.test(data.charAt(index + 1))) {
|
|
91
|
+
index = data.indexOf('<', index + 1);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
let end = data.indexOf('>', index);
|
|
95
|
+
if (end === -1) {
|
|
96
|
+
end = data.length;
|
|
97
|
+
}
|
|
98
|
+
const tag = data.slice(index, end);
|
|
99
|
+
if ((tag.slice(0, 5).toLowerCase() === '<meta' && isOfficeMeta(tag)) ||
|
|
100
|
+
hasMsoClass(tag)) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
index = data.indexOf('<', end);
|
|
104
|
+
}
|
|
105
|
+
return (hasMsoStyle(data, "'") ||
|
|
106
|
+
(hasMsoStyle(data, '"') && data.includes('<font')));
|
|
27
107
|
}
|
|
@@ -5,5 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
7
|
* Check if a string is html or not
|
|
8
|
+
*
|
|
9
|
+
* The pasted text is attacker controlled, so the check walks the string with
|
|
10
|
+
* `indexOf`: the former regex `<(\w+)[^>]*>(.*?)<\/\1>` was quadratic on a
|
|
11
|
+
* long run of `<a>` and froze the tab.
|
|
8
12
|
*/
|
|
9
13
|
export declare const isHTML: (str: unknown) => str is string;
|
|
@@ -7,8 +7,60 @@
|
|
|
7
7
|
* @module helpers/checker
|
|
8
8
|
*/
|
|
9
9
|
import { isString } from "./is-string.js";
|
|
10
|
+
const NAME_START = /[A-Za-z]/;
|
|
11
|
+
const NAME_CHAR = /[A-Za-z0-9]/;
|
|
12
|
+
const WORD_CHAR = /\w/;
|
|
13
|
+
// The tag name at `from`, or '' when there is none
|
|
14
|
+
function readTagName(str, from) {
|
|
15
|
+
if (!NAME_START.test(str.charAt(from))) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
let end = from + 1;
|
|
19
|
+
while (NAME_CHAR.test(str.charAt(end))) {
|
|
20
|
+
end += 1;
|
|
21
|
+
}
|
|
22
|
+
return str.slice(from, end);
|
|
23
|
+
}
|
|
24
|
+
// Is there an element `<name ...>` closed later by `</name>`? One pass for the closing tags, one for the opening ones
|
|
25
|
+
function hasElement(str) {
|
|
26
|
+
const lastClose = new Map();
|
|
27
|
+
let index = str.indexOf('</');
|
|
28
|
+
while (index !== -1) {
|
|
29
|
+
const name = readTagName(str, index + 2);
|
|
30
|
+
if (name !== '' && str.charAt(index + 2 + name.length) === '>') {
|
|
31
|
+
lastClose.set(name, index);
|
|
32
|
+
}
|
|
33
|
+
index = str.indexOf('</', index + 2);
|
|
34
|
+
}
|
|
35
|
+
if (lastClose.size === 0) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
let gt = -1;
|
|
39
|
+
index = str.indexOf('<');
|
|
40
|
+
while (index !== -1) {
|
|
41
|
+
const name = readTagName(str, index + 1);
|
|
42
|
+
const after = index + 1 + name.length;
|
|
43
|
+
if (name !== '' && !WORD_CHAR.test(str.charAt(after))) {
|
|
44
|
+
if (gt < after) {
|
|
45
|
+
gt = str.indexOf('>', after);
|
|
46
|
+
}
|
|
47
|
+
if (gt === -1) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const close = lastClose.get(name);
|
|
51
|
+
if (close !== undefined && close > gt) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
index = str.indexOf('<', index + 1);
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
10
59
|
/**
|
|
11
60
|
* Check if a string is html or not
|
|
61
|
+
*
|
|
62
|
+
* The pasted text is attacker controlled, so the check walks the string with
|
|
63
|
+
* `indexOf`: the former regex `<(\w+)[^>]*>(.*?)<\/\1>` was quadratic on a
|
|
64
|
+
* long run of `<a>` and froze the tab.
|
|
12
65
|
*/
|
|
13
|
-
export const isHTML = (str) => isString(str) &&
|
|
14
|
-
/<([A-Za-z][A-Za-z0-9]*)\b[^>]*>(.*?)<\/\1>/m.test(str.replace(/[\r\n]/g, ''));
|
|
66
|
+
export const isHTML = (str) => isString(str) && hasElement(str);
|
|
@@ -8,17 +8,28 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { globalDocument, IS_PROD } from "../../constants.js";
|
|
10
10
|
import { Dom } from "../../dom/dom.js";
|
|
11
|
+
import { indexOfOpenTag, removeWordWrappers } from "./tag-scan.js";
|
|
11
12
|
import { readWordListItems, wrapWordListItems } from "./word-lists.js";
|
|
12
13
|
import { trim } from "../string/trim.js";
|
|
13
14
|
import { attr } from "../utils/attr.js";
|
|
14
15
|
import { css } from "../utils/css.js";
|
|
15
16
|
import { $$ } from "../utils/selector.js";
|
|
17
|
+
// Drop the `mso-*` and `border*` declarations and turn pt/cm into px; one declaration at a time, so a long value cannot make the regexes backtrack
|
|
16
18
|
function normalizeCSS(s) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
.
|
|
21
|
-
|
|
19
|
+
const declarations = s.split(';');
|
|
20
|
+
const last = declarations.length - 1;
|
|
21
|
+
return declarations
|
|
22
|
+
.filter((declaration, index) => {
|
|
23
|
+
const match = /^\s*([a-z-]{1,64})\s*:/i.exec(declaration);
|
|
24
|
+
if (!match) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
const property = match[1].toLowerCase();
|
|
28
|
+
return !(property.startsWith('mso-') ||
|
|
29
|
+
(property.startsWith('border') && index !== last));
|
|
30
|
+
})
|
|
31
|
+
.join(';')
|
|
32
|
+
.replace(/([0-9.]{1,32})(pt|cm)/gi, (match, units, metrics) => {
|
|
22
33
|
switch (metrics.toLowerCase()) {
|
|
23
34
|
case 'pt':
|
|
24
35
|
return (parseFloat(units) * 1.328).toFixed(0) + 'px';
|
|
@@ -41,11 +52,11 @@ export function applyStyles(html) {
|
|
|
41
52
|
// cell backgrounds/borders, e.g. `.xl31 { background:#FCE4D6 }`) were never
|
|
42
53
|
// inlined and all styling was lost once the `<style>` block got stripped.
|
|
43
54
|
// See https://github.com/xdan/jodit/issues/1362
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
55
|
+
const open = indexOfOpenTag(html, 'html');
|
|
56
|
+
if (open === -1) {
|
|
46
57
|
return html;
|
|
47
58
|
}
|
|
48
|
-
html = html.substring(
|
|
59
|
+
html = html.substring(open);
|
|
49
60
|
const closeIndex = html.toLowerCase().lastIndexOf('</html>');
|
|
50
61
|
if (closeIndex !== -1) {
|
|
51
62
|
html = html.substring(0, closeIndex + '</html>'.length);
|
|
@@ -123,7 +134,5 @@ export function applyStyles(html) {
|
|
|
123
134
|
if (convertedString) {
|
|
124
135
|
html = convertedString;
|
|
125
136
|
}
|
|
126
|
-
return trim(html
|
|
127
|
-
.replace(/<(\/)?(html|colgroup|col|o:p)[^>]*>/g, '')
|
|
128
|
-
.replace(/<!--[^>]*>/g, ''));
|
|
137
|
+
return trim(removeWordWrappers(html));
|
|
129
138
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { globalDocument } from "../../constants.js";
|
|
10
10
|
import { Dom } from "../../dom/dom.js";
|
|
11
11
|
import { toArray } from "../array/to-array.js";
|
|
12
|
+
import { removeWordWrappers } from "./tag-scan.js";
|
|
12
13
|
import { readWordListItems, wrapWordListItems } from "./word-lists.js";
|
|
13
14
|
import { trim } from "../string/trim.js";
|
|
14
15
|
import { attr, attrRaw } from "../utils/attr.js";
|
|
@@ -86,7 +87,5 @@ export function cleanFromWord(html) {
|
|
|
86
87
|
html = convertedString;
|
|
87
88
|
}
|
|
88
89
|
html = html.split(/(\n)/).filter(trim).join('\n');
|
|
89
|
-
return html
|
|
90
|
-
.replace(/<(\/)?(html|colgroup|col|o:p)[^>]*>/g, '')
|
|
91
|
-
.replace(/<!--[^>]*>/g, '');
|
|
90
|
+
return removeWordWrappers(html);
|
|
92
91
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The first `</name>` at or after `from`, case-insensitive, or -1
|
|
8
|
+
*/
|
|
9
|
+
export declare function indexOfClosingTag(html: string, name: string, from: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* Remove every tag that starts with one of the prefixes, up to its `>`:
|
|
12
|
+
* `removeTagsByPrefix(html, ['<meta', '<!--'])`
|
|
13
|
+
*/
|
|
14
|
+
export declare function removeTagsByPrefix(html: string, prefixes: string[]): string;
|
|
15
|
+
/**
|
|
16
|
+
* Strip the Word wrapper tags and then the comments, as the clean-up always did
|
|
17
|
+
*/
|
|
18
|
+
export declare function removeWordWrappers(html: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* The index of the first `<name>` or `<name …>` tag, or -1
|
|
21
|
+
*/
|
|
22
|
+
export declare function indexOfOpenTag(html: string, name: string): number;
|
|
23
|
+
/**
|
|
24
|
+
* Replace every `<name … marker …>inner</name>` with `inner`.
|
|
25
|
+
* `name` null takes any tag; `keep` can refuse an element by its inner HTML.
|
|
26
|
+
*/
|
|
27
|
+
export declare function unwrapMarkedTags(html: string, name: string | null, marker: string, keep?: (inner: string) => boolean): string;
|
|
28
|
+
/**
|
|
29
|
+
* Remove every `open … openEnd … close` block whose opener holds `marker` (any opener when it is ''):
|
|
30
|
+
* `removeBetween(html, '<style', '>', '</style>', 'jodit-box')`
|
|
31
|
+
*/
|
|
32
|
+
export declare function removeBetween(html: string, open: string, openEnd: string, close: string, marker?: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Remove every empty `<name … marker …></name>` element
|
|
35
|
+
*/
|
|
36
|
+
export declare function removeEmptyMarkedTags(html: string, name: string, marker: string): string;
|