jodit 4.19.14 → 4.20.1
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 +30 -0
- package/es2015/jodit.css +76 -1
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +12 -12
- package/es2015/jodit.js +1464 -599
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +12 -12
- 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 +12 -12
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +12 -12
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +76 -1
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +17 -17
- package/es2021/jodit.js +1445 -596
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +17 -17
- 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 +76 -1
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +17 -17
- package/es2021.en/jodit.js +1419 -570
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +17 -17
- 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 +96 -2
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +1707 -706
- 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/config.d.ts +10 -3
- package/esm/core/constants.js +1 -1
- package/esm/core/helpers/utils/anchor.d.ts +22 -0
- package/esm/core/helpers/utils/anchor.js +29 -0
- package/esm/core/helpers/utils/index.d.ts +1 -0
- package/esm/core/helpers/utils/index.js +1 -0
- package/esm/core/ui/form/inputs/input/input.js +2 -0
- package/esm/core/ui/popup/popup.d.ts +5 -0
- package/esm/core/ui/popup/popup.js +5 -0
- package/esm/jodit.js +11 -14
- package/esm/langs/ar.d.ts +5 -0
- package/esm/langs/ar.js +5 -0
- package/esm/langs/az.d.ts +5 -0
- package/esm/langs/az.js +5 -0
- package/esm/langs/cs_cz.d.ts +5 -0
- package/esm/langs/cs_cz.js +6 -1
- package/esm/langs/de.d.ts +5 -0
- package/esm/langs/de.js +6 -0
- package/esm/langs/es.d.ts +5 -0
- package/esm/langs/es.js +6 -1
- package/esm/langs/fa.d.ts +5 -0
- package/esm/langs/fa.js +6 -1
- package/esm/langs/fi.d.ts +5 -0
- package/esm/langs/fi.js +5 -0
- package/esm/langs/fr.d.ts +5 -0
- package/esm/langs/fr.js +5 -0
- package/esm/langs/he.d.ts +5 -0
- package/esm/langs/he.js +6 -1
- package/esm/langs/hu.d.ts +5 -0
- package/esm/langs/hu.js +5 -0
- package/esm/langs/id.d.ts +5 -0
- package/esm/langs/id.js +6 -1
- package/esm/langs/it.d.ts +5 -0
- package/esm/langs/it.js +6 -1
- package/esm/langs/ja.d.ts +5 -0
- package/esm/langs/ja.js +6 -1
- package/esm/langs/ko.d.ts +5 -0
- package/esm/langs/ko.js +6 -1
- package/esm/langs/mn.d.ts +5 -0
- package/esm/langs/mn.js +6 -1
- package/esm/langs/nl.d.ts +5 -0
- package/esm/langs/nl.js +5 -0
- package/esm/langs/no.d.ts +5 -0
- package/esm/langs/no.js +5 -0
- package/esm/langs/pl.d.ts +5 -0
- package/esm/langs/pl.js +5 -0
- package/esm/langs/pt_br.d.ts +5 -0
- package/esm/langs/pt_br.js +6 -1
- package/esm/langs/ru.d.ts +5 -0
- package/esm/langs/ru.js +6 -1
- package/esm/langs/sk.d.ts +5 -0
- package/esm/langs/sk.js +5 -0
- package/esm/langs/sv.d.ts +5 -0
- package/esm/langs/sv.js +5 -0
- package/esm/langs/tr.d.ts +5 -0
- package/esm/langs/tr.js +6 -1
- package/esm/langs/ua.d.ts +5 -0
- package/esm/langs/ua.js +6 -1
- package/esm/langs/zh_cn.d.ts +5 -0
- package/esm/langs/zh_cn.js +6 -1
- package/esm/langs/zh_tw.d.ts +5 -0
- package/esm/langs/zh_tw.js +5 -0
- package/esm/modules/file-browser/file-browser.d.ts +3 -4
- package/esm/modules/file-browser/file-browser.js +12 -12
- package/esm/modules/toolbar/button/button.d.ts +7 -0
- package/esm/modules/toolbar/button/button.js +32 -4
- package/esm/modules/uploader/config.js +18 -18
- package/esm/modules/uploader/helpers/index.d.ts +1 -0
- package/esm/modules/uploader/helpers/index.js +1 -0
- package/esm/modules/uploader/helpers/normalize-uploader-data.d.ts +32 -0
- package/esm/modules/uploader/helpers/normalize-uploader-data.js +54 -0
- package/esm/modules/uploader/helpers/send-files.js +11 -6
- package/esm/modules/uploader/uploader.d.ts +4 -5
- package/esm/modules/uploader/uploader.js +12 -8
- package/esm/plugins/all.d.ts +1 -0
- package/esm/plugins/all.js +1 -0
- package/esm/plugins/anchor/anchor.d.ts +67 -0
- package/esm/plugins/anchor/anchor.js +302 -0
- package/esm/plugins/anchor/config.d.ts +6 -0
- package/esm/plugins/anchor/config.js +13 -0
- package/esm/plugins/file/file.d.ts +1 -1
- package/esm/plugins/file/file.js +6 -6
- package/esm/plugins/image/image.js +2 -2
- package/esm/plugins/image-caption/image-caption.js +1 -2
- package/esm/plugins/image-properties/utils/open-image-popup.js +7 -6
- package/esm/plugins/index.d.ts +1 -0
- package/esm/plugins/inline-popup/config/config.d.ts +8 -2
- package/esm/plugins/inline-popup/config/config.js +1 -0
- package/esm/plugins/inline-popup/config/items/cells.js +0 -10
- package/esm/plugins/inline-popup/config/items/img.js +1 -1
- package/esm/plugins/inline-popup/inline-popup.d.ts +9 -12
- package/esm/plugins/inline-popup/inline-popup.js +53 -77
- package/esm/plugins/link/link.js +150 -3
- package/esm/plugins/link/template.js +3 -1
- package/esm/plugins/resizer/resizer.d.ts +6 -0
- package/esm/plugins/resizer/resizer.js +11 -0
- package/esm/plugins/select/select.d.ts +31 -0
- package/esm/plugins/select/select.js +235 -2
- package/esm/plugins/select-cells/select-cells.d.ts +11 -0
- package/esm/plugins/select-cells/select-cells.js +48 -17
- package/esm/plugins/video/config.d.ts +1 -1
- package/esm/plugins/video/config.js +4 -3
- package/esm/plugins/video-properties/video-properties.js +7 -6
- package/esm/styles/icons/anchor.svg.js +1 -0
- package/esm/styles/icons/index.d.ts +1 -1
- package/esm/styles/icons/index.js +2 -1
- package/esm/types/file-browser.d.ts +8 -1
- package/esm/types/popup.d.ts +1 -0
- package/esm/types/uploader.d.ts +39 -1
- package/package.json +1 -1
- package/types/config.d.ts +10 -3
- package/types/core/helpers/utils/anchor.d.ts +22 -0
- package/types/core/helpers/utils/index.d.ts +1 -0
- package/types/core/ui/popup/popup.d.ts +5 -0
- package/types/langs/ar.d.ts +5 -0
- package/types/langs/az.d.ts +5 -0
- package/types/langs/cs_cz.d.ts +5 -0
- package/types/langs/de.d.ts +5 -0
- package/types/langs/es.d.ts +5 -0
- package/types/langs/fa.d.ts +5 -0
- package/types/langs/fi.d.ts +5 -0
- package/types/langs/fr.d.ts +5 -0
- package/types/langs/he.d.ts +5 -0
- package/types/langs/hu.d.ts +5 -0
- package/types/langs/id.d.ts +5 -0
- package/types/langs/it.d.ts +5 -0
- package/types/langs/ja.d.ts +5 -0
- package/types/langs/ko.d.ts +5 -0
- package/types/langs/mn.d.ts +5 -0
- package/types/langs/nl.d.ts +5 -0
- package/types/langs/no.d.ts +5 -0
- package/types/langs/pl.d.ts +5 -0
- package/types/langs/pt_br.d.ts +5 -0
- package/types/langs/ru.d.ts +5 -0
- package/types/langs/sk.d.ts +5 -0
- package/types/langs/sv.d.ts +5 -0
- package/types/langs/tr.d.ts +5 -0
- package/types/langs/ua.d.ts +5 -0
- package/types/langs/zh_cn.d.ts +5 -0
- package/types/langs/zh_tw.d.ts +5 -0
- package/types/modules/file-browser/file-browser.d.ts +3 -4
- package/types/modules/toolbar/button/button.d.ts +7 -0
- package/types/modules/uploader/helpers/index.d.ts +1 -0
- package/types/modules/uploader/helpers/normalize-uploader-data.d.ts +32 -0
- package/types/modules/uploader/uploader.d.ts +4 -5
- package/types/plugins/anchor/anchor.d.ts +67 -0
- package/types/plugins/anchor/config.d.ts +6 -0
- package/types/plugins/file/file.d.ts +1 -1
- package/types/plugins/index.d.ts +1 -0
- package/types/plugins/inline-popup/config/config.d.ts +8 -2
- package/types/plugins/inline-popup/inline-popup.d.ts +9 -12
- package/types/plugins/resizer/resizer.d.ts +6 -0
- package/types/plugins/select/select.d.ts +31 -0
- package/types/plugins/select-cells/select-cells.d.ts +11 -0
- package/types/plugins/video/config.d.ts +1 -1
- package/types/styles/icons/index.d.ts +1 -1
- package/types/types/file-browser.d.ts +8 -1
- package/types/types/popup.d.ts +1 -0
- package/types/types/uploader.d.ts +39 -1
|
@@ -20,7 +20,7 @@ declare module 'jodit/config' {
|
|
|
20
20
|
* Jodit.make('#editor', {
|
|
21
21
|
* file: {
|
|
22
22
|
* defaultHandlerSuccess(data) {
|
|
23
|
-
* data.
|
|
23
|
+
* data.items.forEach(({ file }) => {
|
|
24
24
|
* this.s.insertHTML(`<a class="file" href="${data.baseurl + file}">${file}</a>`);
|
|
25
25
|
* });
|
|
26
26
|
* }
|
package/esm/plugins/file/file.js
CHANGED
|
@@ -7,6 +7,7 @@ import { Dom } from "../../core/dom/dom.js";
|
|
|
7
7
|
import { pluginSystem } from "../../core/global.js";
|
|
8
8
|
import { attr } from "../../core/helpers/utils/attr.js";
|
|
9
9
|
import { Config } from "../../config.js";
|
|
10
|
+
import { getItems } from "../../modules/uploader/helpers/normalize-uploader-data.js";
|
|
10
11
|
import { FileSelectorWidget } from "../../modules/widget/index.js";
|
|
11
12
|
/**
|
|
12
13
|
* Selected text becomes the link's text, as the Link button does, instead
|
|
@@ -30,14 +31,14 @@ function wrapSelectionInLink(editor, href, title = '') {
|
|
|
30
31
|
return true;
|
|
31
32
|
}
|
|
32
33
|
function insertLinks(data) {
|
|
33
|
-
|
|
34
|
-
(
|
|
35
|
-
const href =
|
|
34
|
+
const { baseurl } = data;
|
|
35
|
+
getItems(data).forEach(({ file }) => {
|
|
36
|
+
const href = baseurl + file;
|
|
36
37
|
if (wrapSelectionInLink(this, href)) {
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
40
|
const link = this.createInside.element('a', { href });
|
|
40
|
-
link.textContent = this.o.uploader.getDisplayName.call(this.uploader,
|
|
41
|
+
link.textContent = this.o.uploader.getDisplayName.call(this.uploader, baseurl, file);
|
|
41
42
|
this.s.insertNode(link);
|
|
42
43
|
});
|
|
43
44
|
}
|
|
@@ -71,8 +72,7 @@ Config.prototype.controls.file = {
|
|
|
71
72
|
}
|
|
72
73
|
return FileSelectorWidget(editor, {
|
|
73
74
|
filebrowser: (data) => {
|
|
74
|
-
data.
|
|
75
|
-
data.files.forEach(file => insert(data.baseurl + file));
|
|
75
|
+
getItems(data).forEach(({ file }) => insert(data.baseurl + file));
|
|
76
76
|
close();
|
|
77
77
|
},
|
|
78
78
|
upload: (data) => {
|
|
@@ -9,6 +9,7 @@ import { $$ } from "../../core/helpers/index.js";
|
|
|
9
9
|
import { attr } from "../../core/helpers/utils/attr.js";
|
|
10
10
|
import { Icon } from "../../core/ui/icon.js";
|
|
11
11
|
import { Config } from "../../config.js";
|
|
12
|
+
import { getItems } from "../../modules/uploader/helpers/normalize-uploader-data.js";
|
|
12
13
|
import { FileSelectorWidget } from "../../modules/widget/index.js";
|
|
13
14
|
import imageIcon from "./image.svg.js";
|
|
14
15
|
Icon.set('image', imageIcon);
|
|
@@ -27,8 +28,7 @@ Config.prototype.controls.image = {
|
|
|
27
28
|
return FileSelectorWidget(editor, {
|
|
28
29
|
filebrowser: (data) => {
|
|
29
30
|
editor.s.restore();
|
|
30
|
-
data.
|
|
31
|
-
data.files.forEach(file => editor.s.insertImage(data.baseurl + file, null, editor.o.imageDefaultWidth));
|
|
31
|
+
getItems(data).forEach(({ file }) => editor.s.insertImage(data.baseurl + file, null, editor.o.imageDefaultWidth));
|
|
32
32
|
close();
|
|
33
33
|
},
|
|
34
34
|
upload: true,
|
|
@@ -425,10 +425,9 @@ export class imageCaption extends Plugin {
|
|
|
425
425
|
const fresh = this.__freshCaption(wrapper);
|
|
426
426
|
this.__unrecorded(() => fresh ? this.__restore(fresh) : this.__uncaption(wrapper, image));
|
|
427
427
|
// The click opened the image's popup below the caption, so it
|
|
428
|
-
//
|
|
428
|
+
// moves below the image, as after the popup's Caption button
|
|
429
429
|
if (clicked) {
|
|
430
430
|
j.e.fire('recalcPositionPopup');
|
|
431
|
-
j.e.fire('closeAllPopups');
|
|
432
431
|
}
|
|
433
432
|
}, 1);
|
|
434
433
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
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
|
-
import { isArray } from "../../../core/helpers/checker/is-array.js";
|
|
7
6
|
import { position } from "../../../core/helpers/size/position.js";
|
|
8
7
|
import { Popup } from "../../../core/ui/popup/popup.js";
|
|
8
|
+
import { getItems } from "../../../modules/uploader/helpers/normalize-uploader-data.js";
|
|
9
9
|
import { FileSelectorWidget } from "../../../modules/widget/file-selector/file-selector.js";
|
|
10
10
|
/** @private */
|
|
11
11
|
export function openImagePopup(j, dialog, state, button) {
|
|
@@ -17,15 +17,16 @@ export function openImagePopup(j, dialog, state, button) {
|
|
|
17
17
|
popup
|
|
18
18
|
.setContent(FileSelectorWidget(j, {
|
|
19
19
|
upload: (data) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const [item] = getItems(data);
|
|
21
|
+
if (item) {
|
|
22
|
+
state.values.imageSrc = data.baseurl + item.file;
|
|
23
23
|
}
|
|
24
24
|
closePopup();
|
|
25
25
|
},
|
|
26
26
|
filebrowser: async (data) => {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const [item] = data ? getItems(data) : [];
|
|
28
|
+
if (item) {
|
|
29
|
+
state.values.imageSrc = item.file;
|
|
29
30
|
closePopup();
|
|
30
31
|
}
|
|
31
32
|
}
|
package/esm/plugins/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ import "./key-arrow-outside/key-arrow-outside";
|
|
|
40
40
|
import "./limit/limit";
|
|
41
41
|
import "./line-height/line-height";
|
|
42
42
|
import "./link/link";
|
|
43
|
+
import "./anchor/anchor";
|
|
43
44
|
import "./media/media";
|
|
44
45
|
import "./mobile/mobile";
|
|
45
46
|
import "./ordered-list/ordered-list";
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module plugins/inline-popup
|
|
8
8
|
*/
|
|
9
|
-
import type { IControlType, IDictionary, IJodit } from "../../../types/index";
|
|
9
|
+
import type { IControlType, IDictionary, IJodit, IUIElement } from "../../../types/index";
|
|
10
10
|
declare module 'jodit/config' {
|
|
11
11
|
interface Config {
|
|
12
12
|
/**
|
|
13
13
|
* Element-specific popup toolbars. Keys are tag names (e.g. `img`, `a`, `cells`)
|
|
14
14
|
* and values are button lists or factory functions that return them.
|
|
15
15
|
*/
|
|
16
|
-
popup: IDictionary<Array<IControlType | string> | ((editor: IJodit, target: HTMLElement | undefined, close: () => void) => Array<IControlType | string> | HTMLElement | string)>;
|
|
16
|
+
popup: IDictionary<Array<IControlType | string> | ((editor: IJodit, target: HTMLElement | undefined, close: () => void) => Array<IControlType | string> | HTMLElement | IUIElement | string)>;
|
|
17
17
|
/**
|
|
18
18
|
* List of button names to exclude from the inline toolbar
|
|
19
19
|
*/
|
|
@@ -26,6 +26,12 @@ declare module 'jodit/config' {
|
|
|
26
26
|
* Show an inline toolbar when the user selects text
|
|
27
27
|
*/
|
|
28
28
|
toolbarInlineForSelection: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Keep an inline toolbar open after one of its buttons runs, beside its
|
|
31
|
+
* element or the selection. A list the button opened still closes.
|
|
32
|
+
* `false` closes the toolbar after every button
|
|
33
|
+
*/
|
|
34
|
+
toolbarInlineKeepOpen: boolean;
|
|
29
35
|
/**
|
|
30
36
|
* CSS selector or array of selectors for elements that should not trigger the inline toolbar
|
|
31
37
|
*/
|
|
@@ -22,6 +22,7 @@ import * as th from "../icons/th.svg.js";
|
|
|
22
22
|
import * as thList from "../icons/th-list.svg.js";
|
|
23
23
|
Config.prototype.toolbarInline = true;
|
|
24
24
|
Config.prototype.toolbarInlineForSelection = false;
|
|
25
|
+
Config.prototype.toolbarInlineKeepOpen = true;
|
|
25
26
|
Config.prototype.toolbarInlineDisableFor = [];
|
|
26
27
|
Config.prototype.toolbarInlineDisabledButtons = ['source'];
|
|
27
28
|
Icon.set('addcolumn', addcolumn.default)
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { Dom } from "../../../../core/dom/dom.js";
|
|
7
7
|
import { isJoditObject, isString } from "../../../../core/helpers/checker/index.js";
|
|
8
|
-
import { position } from "../../../../core/helpers/size/position.js";
|
|
9
8
|
import { css } from "../../../../core/helpers/utils/css.js";
|
|
10
9
|
const cmd = (control) => control.args && isString(control.args[0])
|
|
11
10
|
? control.args[0].toLowerCase()
|
|
@@ -88,15 +87,6 @@ export default [
|
|
|
88
87
|
return;
|
|
89
88
|
}
|
|
90
89
|
editor.execCommand('tableheaderrow', false, table);
|
|
91
|
-
const [cell] = editor
|
|
92
|
-
.getInstance('Table', editor.o)
|
|
93
|
-
.getAllSelectedCells();
|
|
94
|
-
// Beside the cell that replaced the one it opened for
|
|
95
|
-
if (cell) {
|
|
96
|
-
editor.e.fire('showPopup', table, () => position(cell, editor), 'cells');
|
|
97
|
-
}
|
|
98
|
-
// The popup stays open, so the button shows the new state
|
|
99
|
-
return true;
|
|
100
90
|
},
|
|
101
91
|
isActive: (editor, button) => Dom.isTag(button.target, 'table') &&
|
|
102
92
|
editor
|
|
@@ -106,7 +106,7 @@ export default [
|
|
|
106
106
|
const caption = editor.e.fire('toggleImageCaption', image);
|
|
107
107
|
editor.synchronizeValues();
|
|
108
108
|
if (Dom.isHTMLElement(caption)) {
|
|
109
|
-
editor.e.fire('hideResizer');
|
|
109
|
+
editor.e.fire('hidePopup hideResizer');
|
|
110
110
|
editor.s.setCursorIn(caption);
|
|
111
111
|
}
|
|
112
112
|
else {
|
|
@@ -29,6 +29,7 @@ export declare class inlinePopup extends Plugin {
|
|
|
29
29
|
* Show inline popup with some toolbar
|
|
30
30
|
*
|
|
31
31
|
* @param type - selection, img, a etc.
|
|
32
|
+
* @param force - make the popup again for the same target
|
|
32
33
|
*/
|
|
33
34
|
private showPopup;
|
|
34
35
|
private previousTarget?;
|
|
@@ -59,20 +60,9 @@ export declare class inlinePopup extends Plugin {
|
|
|
59
60
|
/** @override **/
|
|
60
61
|
protected afterInit(jodit: IJodit): void;
|
|
61
62
|
/**
|
|
62
|
-
*
|
|
63
|
-
* command fires `closeAllPopups`, the toolbar should be shown again
|
|
64
|
-
* while the selection is still there. See #1238
|
|
63
|
+
* Follow the element once a control has moved it, as the alignments do
|
|
65
64
|
*/
|
|
66
|
-
private __reopenSelectionPopup;
|
|
67
|
-
/**
|
|
68
|
-
* The alignment controls fire `recalcPositionPopup` once they have moved
|
|
69
|
-
* the element, and their button then fires `closeAllPopups`. The popup
|
|
70
|
-
* opens again beside the element, as the selection toolbar does
|
|
71
|
-
*/
|
|
72
|
-
private __reopenFor;
|
|
73
65
|
protected onRecalcPositionPopup(): void;
|
|
74
|
-
private __onDocumentMouseDown;
|
|
75
|
-
private __onCloseAllPopups;
|
|
76
66
|
/**
|
|
77
67
|
* The selection rect comes from the editor document — in iframe mode its
|
|
78
68
|
* coordinates are iframe-local, while the popup lives in the host
|
|
@@ -88,6 +78,13 @@ export declare class inlinePopup extends Plugin {
|
|
|
88
78
|
* Selection change handler
|
|
89
79
|
*/
|
|
90
80
|
private onSelectionChange;
|
|
81
|
+
/**
|
|
82
|
+
* The selection holds more than a line break. A double click past the end
|
|
83
|
+
* of a line, or a drag from there into the next, selects only the break,
|
|
84
|
+
* with any rule, video or empty line it crosses: it starts at the end of a
|
|
85
|
+
* line, after everything in it, and holds no text that shows
|
|
86
|
+
*/
|
|
87
|
+
private __hasSelectedContent;
|
|
91
88
|
/**
|
|
92
89
|
* In not collapsed selection - only one image
|
|
93
90
|
*/
|
|
@@ -30,24 +30,14 @@ export class inlinePopup extends Plugin {
|
|
|
30
30
|
constructor() {
|
|
31
31
|
super(...arguments);
|
|
32
32
|
this.type = null;
|
|
33
|
-
/**
|
|
34
|
-
* The user pressed a button inside the selection toolbar — after the
|
|
35
|
-
* command fires `closeAllPopups`, the toolbar should be shown again
|
|
36
|
-
* while the selection is still there. See #1238
|
|
37
|
-
*/
|
|
38
|
-
this.__reopenSelectionPopup = false;
|
|
39
|
-
/**
|
|
40
|
-
* The alignment controls fire `recalcPositionPopup` once they have moved
|
|
41
|
-
* the element, and their button then fires `closeAllPopups`. The popup
|
|
42
|
-
* opens again beside the element, as the selection toolbar does
|
|
43
|
-
*/
|
|
44
|
-
this.__reopenFor = null;
|
|
45
33
|
this.snapRange = null;
|
|
46
34
|
this.__keyDownElement = null;
|
|
47
35
|
this.elmsList = keys(this.j.o.popup, false).filter(s => !this.isExcludedTarget(s));
|
|
48
36
|
}
|
|
49
37
|
get popup() {
|
|
50
|
-
|
|
38
|
+
const popup = new Popup(this.jodit, false);
|
|
39
|
+
popup.keepOpen = this.j.o.toolbarInlineKeepOpen;
|
|
40
|
+
return popup;
|
|
51
41
|
}
|
|
52
42
|
get toolbar() {
|
|
53
43
|
return makeCollection(this.jodit, this.popup);
|
|
@@ -64,10 +54,10 @@ export class inlinePopup extends Plugin {
|
|
|
64
54
|
const isMedia = type === 'jodit-media';
|
|
65
55
|
// Beside the media in a wrapper kept in the content, which can fill
|
|
66
56
|
// the line, and below a captioned image's caption, so it stays in view
|
|
67
|
-
const bound = (mediaWrapper && getWrappedMedia(this.j, mediaWrapper)) ||
|
|
57
|
+
const bound = () => (mediaWrapper && getWrappedMedia(this.j, mediaWrapper)) ||
|
|
68
58
|
getCaptionWrapper(this.j, target) ||
|
|
69
59
|
target;
|
|
70
|
-
this.showPopup(() => this.__bound(bound, isMedia), type, target);
|
|
60
|
+
this.showPopup(() => this.__bound(bound(), isMedia), type, target);
|
|
71
61
|
return false;
|
|
72
62
|
}
|
|
73
63
|
}
|
|
@@ -94,14 +84,19 @@ export class inlinePopup extends Plugin {
|
|
|
94
84
|
* Show inline popup with some toolbar
|
|
95
85
|
*
|
|
96
86
|
* @param type - selection, img, a etc.
|
|
87
|
+
* @param force - make the popup again for the same target
|
|
97
88
|
*/
|
|
98
|
-
showPopup(rect, type, target) {
|
|
89
|
+
showPopup(rect, type, target, force = false) {
|
|
99
90
|
type = type.toLowerCase();
|
|
100
91
|
if (!this.canShowPopupForType(type)) {
|
|
101
92
|
return false;
|
|
102
93
|
}
|
|
103
|
-
if (this.type !== type || target !== this.previousTarget) {
|
|
94
|
+
if (force || this.type !== type || target !== this.previousTarget) {
|
|
104
95
|
this.previousTarget = target;
|
|
96
|
+
// What it showed is taken out, not destructed: an element a
|
|
97
|
+
// function returns is its own, and may be shown again
|
|
98
|
+
this.popup.elements.slice().forEach(elm => this.popup.remove(elm));
|
|
99
|
+
Dom.detach(this.popup.getElm('content'));
|
|
105
100
|
const data = this.j.o.popup[type];
|
|
106
101
|
let content;
|
|
107
102
|
if (isFunction(data)) {
|
|
@@ -207,65 +202,31 @@ export class inlinePopup extends Plugin {
|
|
|
207
202
|
})
|
|
208
203
|
.on('hidePopup', this.hidePopup)
|
|
209
204
|
.on('showInlineToolbar', this.showInlineToolbar)
|
|
210
|
-
.on('showPopup', (elm, rect, type) => {
|
|
211
|
-
this.showPopup(rect, type || (isString(elm) ? elm : elm.nodeName), isString(elm) ? undefined : elm);
|
|
205
|
+
.on('showPopup', (elm, rect, type, force) => {
|
|
206
|
+
this.showPopup(rect, type || (isString(elm) ? elm : elm.nodeName), isString(elm) ? undefined : elm, force);
|
|
212
207
|
})
|
|
213
208
|
.on('mousedown keydown', this.onSelectionStart)
|
|
214
209
|
.on('change', () => {
|
|
215
|
-
if (this.popup.isOpened
|
|
216
|
-
|
|
217
|
-
|
|
210
|
+
if (!this.popup.isOpened) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (this.previousTarget && !this.previousTarget.parentNode) {
|
|
218
214
|
this.hidePopup();
|
|
219
215
|
this.previousTarget = undefined;
|
|
220
216
|
}
|
|
217
|
+
else if (this.type === 'selection' &&
|
|
218
|
+
!this.__hasSelectedContent()) {
|
|
219
|
+
this.hidePopup();
|
|
220
|
+
}
|
|
221
221
|
})
|
|
222
|
-
.on([this.j.ew, this.j.ow], 'mouseup keyup', this.onSelectionEnd)
|
|
223
|
-
.on([this.j.ew, this.j.ow], 'mousedown touchstart', this.__onDocumentMouseDown)
|
|
224
|
-
.on('closeAllPopups', this.__onCloseAllPopups);
|
|
222
|
+
.on([this.j.ew, this.j.ow], 'mouseup keyup', this.onSelectionEnd);
|
|
225
223
|
this.addListenersForElements();
|
|
226
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Follow the element once a control has moved it, as the alignments do
|
|
227
|
+
*/
|
|
227
228
|
onRecalcPositionPopup() {
|
|
228
|
-
|
|
229
|
-
this.type !== 'selection' &&
|
|
230
|
-
this.previousTarget) {
|
|
231
|
-
this.__reopenFor = this.previousTarget;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
__onDocumentMouseDown(e) {
|
|
235
|
-
this.__reopenFor = null;
|
|
236
|
-
if (this.popup.isOpened &&
|
|
237
|
-
this.type === 'selection' &&
|
|
238
|
-
e.target &&
|
|
239
|
-
UIElement.closestElement(e.target, Popup)) {
|
|
240
|
-
this.__reopenSelectionPopup = true;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
__onCloseAllPopups() {
|
|
244
|
-
const target = this.__reopenFor;
|
|
245
|
-
if (target) {
|
|
246
|
-
this.__reopenFor = null;
|
|
247
|
-
// After the popup's own `closeAllPopups` handler, as below
|
|
248
|
-
this.j.async.setTimeout(() => {
|
|
249
|
-
if (this.j.editor.contains(target)) {
|
|
250
|
-
this.onClick(target);
|
|
251
|
-
}
|
|
252
|
-
}, 1);
|
|
253
|
-
}
|
|
254
|
-
if (!this.__reopenSelectionPopup) {
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
this.__reopenSelectionPopup = false;
|
|
258
|
-
if (!this.j.o.toolbarInlineForSelection) {
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
// a zero timeout would run synchronously — before the popup's own
|
|
262
|
-
// `closeAllPopups` handler closes it; defer to the next macrotask
|
|
263
|
-
this.j.async.setTimeout(() => {
|
|
264
|
-
const sel = this.j.s.sel;
|
|
265
|
-
if (sel && !sel.isCollapsed) {
|
|
266
|
-
this.showPopup(() => this.__selectionBound(), 'selection');
|
|
267
|
-
}
|
|
268
|
-
}, 1);
|
|
229
|
+
this.popup.updatePosition();
|
|
269
230
|
}
|
|
270
231
|
/**
|
|
271
232
|
* The selection rect comes from the editor document — in iframe mode its
|
|
@@ -315,9 +276,8 @@ export class inlinePopup extends Plugin {
|
|
|
315
276
|
return;
|
|
316
277
|
}
|
|
317
278
|
const type = 'selection';
|
|
318
|
-
const sel = this.j.s.sel;
|
|
319
279
|
const range = this.j.s.range;
|
|
320
|
-
if ((
|
|
280
|
+
if (!this.__hasSelectedContent() || this.isSelectedTarget(range)) {
|
|
321
281
|
if (this.type === type && this.popup.isOpened) {
|
|
322
282
|
this.hidePopup();
|
|
323
283
|
}
|
|
@@ -329,6 +289,30 @@ export class inlinePopup extends Plugin {
|
|
|
329
289
|
}
|
|
330
290
|
this.showPopup(() => this.__selectionBound(), type);
|
|
331
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* The selection holds more than a line break. A double click past the end
|
|
294
|
+
* of a line, or a drag from there into the next, selects only the break,
|
|
295
|
+
* with any rule, video or empty line it crosses: it starts at the end of a
|
|
296
|
+
* line, after everything in it, and holds no text that shows
|
|
297
|
+
*/
|
|
298
|
+
__hasSelectedContent() {
|
|
299
|
+
const { sel, range } = this.j.s;
|
|
300
|
+
if (!sel || sel.isCollapsed) {
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
// HTML collapses ASCII white space, but not
|
|
304
|
+
const showsText = (r) => /[^\t\n\f\r \uFEFF\u200B]/.test(r.toString());
|
|
305
|
+
const line = Dom.closest(range.startContainer, Dom.isBlock, this.j.editor);
|
|
306
|
+
if (!line || line === this.j.editor || showsText(range)) {
|
|
307
|
+
return true;
|
|
308
|
+
}
|
|
309
|
+
// The rest of the line after the selection's start
|
|
310
|
+
const rest = this.j.s.createRange();
|
|
311
|
+
rest.setStart(range.startContainer, range.startOffset);
|
|
312
|
+
rest.setEnd(line, line.childNodes.length);
|
|
313
|
+
return (showsText(rest) ||
|
|
314
|
+
toArray(line.querySelectorAll(':not(br):empty')).some(elm => rest.intersectsNode(elm)));
|
|
315
|
+
}
|
|
332
316
|
/**
|
|
333
317
|
* In not collapsed selection - only one image
|
|
334
318
|
*/
|
|
@@ -349,9 +333,7 @@ export class inlinePopup extends Plugin {
|
|
|
349
333
|
beforeDestruct(jodit) {
|
|
350
334
|
jodit.e
|
|
351
335
|
.off('showPopup')
|
|
352
|
-
.off([this.j.ew, this.j.ow], 'mouseup keyup', this.onSelectionEnd)
|
|
353
|
-
.off([this.j.ew, this.j.ow], 'mousedown touchstart', this.__onDocumentMouseDown)
|
|
354
|
-
.off('closeAllPopups', this.__onCloseAllPopups);
|
|
336
|
+
.off([this.j.ew, this.j.ow], 'mouseup keyup', this.onSelectionEnd);
|
|
355
337
|
this.removeListenersForElements();
|
|
356
338
|
}
|
|
357
339
|
_eventsList() {
|
|
@@ -409,12 +391,6 @@ __decorate([
|
|
|
409
391
|
__decorate([
|
|
410
392
|
watch(':recalcPositionPopup')
|
|
411
393
|
], inlinePopup.prototype, "onRecalcPositionPopup", null);
|
|
412
|
-
__decorate([
|
|
413
|
-
autobind
|
|
414
|
-
], inlinePopup.prototype, "__onDocumentMouseDown", null);
|
|
415
|
-
__decorate([
|
|
416
|
-
autobind
|
|
417
|
-
], inlinePopup.prototype, "__onCloseAllPopups", null);
|
|
418
394
|
__decorate([
|
|
419
395
|
autobind
|
|
420
396
|
], inlinePopup.prototype, "onSelectionStart", null);
|
package/esm/plugins/link/link.js
CHANGED
|
@@ -13,12 +13,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
13
13
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
14
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
15
|
};
|
|
16
|
-
import { KEY_BACKSPACE, KEY_TAB } from "../../core/constants.js";
|
|
16
|
+
import { KEY_BACKSPACE, KEY_DOWN, KEY_ESC, KEY_TAB, KEY_UP } from "../../core/constants.js";
|
|
17
17
|
import { autobind } from "../../core/decorators/index.js";
|
|
18
18
|
import { Dom } from "../../core/dom/index.js";
|
|
19
|
-
import { pluginSystem } from "../../core/global.js";
|
|
20
|
-
import { attr, call, convertMediaUrlToVideoEmbed, isString, isURL, prepareEmbedCode, refs, stripTags } from "../../core/helpers/index.js";
|
|
19
|
+
import { pluginSystem, uniqueUid } from "../../core/global.js";
|
|
20
|
+
import { attr, call, convertMediaUrlToVideoEmbed, getAnchorName, getAnchors, isString, isURL, position, prepareEmbedCode, refs, stripTags } from "../../core/helpers/index.js";
|
|
21
21
|
import { Plugin } from "../../core/plugin/index.js";
|
|
22
|
+
import { UIElement } from "../../core/ui/element.js";
|
|
23
|
+
import { Icon } from "../../core/ui/icon.js";
|
|
24
|
+
import { Popup } from "../../core/ui/popup/popup.js";
|
|
22
25
|
import "./config.js";
|
|
23
26
|
import { EMAIL, findTypedLink } from "./typed-link.js";
|
|
24
27
|
/**
|
|
@@ -205,6 +208,7 @@ export class link extends Plugin {
|
|
|
205
208
|
target_checkbox.checked = openInNewTabCheckboxDefaultChecked;
|
|
206
209
|
}
|
|
207
210
|
}
|
|
211
|
+
addAnchorList(jodit, url_input, content_input, isImageContent);
|
|
208
212
|
jodit.editor.normalize();
|
|
209
213
|
const snapshot = jodit.history.snapshot.make();
|
|
210
214
|
if (unlink) {
|
|
@@ -453,6 +457,149 @@ __decorate([
|
|
|
453
457
|
const NO_TYPED_LINKS = new Set(['a', 'pre', 'code']);
|
|
454
458
|
const MODIFIER_KEYS = new Set(['Shift', 'Control', 'Alt', 'Meta', 'CapsLock']);
|
|
455
459
|
pluginSystem.add('link', link);
|
|
460
|
+
/**
|
|
461
|
+
* A dropdown arrow in the URL field that lists the document's anchors by the
|
|
462
|
+
* words after them, and fills in the one picked. The list opens in a popup of
|
|
463
|
+
* its own, from the arrow or the down arrow key, and closes once an address is
|
|
464
|
+
* typed
|
|
465
|
+
*/
|
|
466
|
+
function addAnchorList(jodit, url, content, isImage) {
|
|
467
|
+
const anchors = getAnchors(jodit.editor);
|
|
468
|
+
const field = url === null || url === void 0 ? void 0 : url.closest('.jodit-ui-input__wrapper');
|
|
469
|
+
const input = field && UIElement.closestElement(field, UIElement);
|
|
470
|
+
if (!field || !input || !anchors.length) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
const { c } = jodit;
|
|
474
|
+
const label = jodit.i18n('Link to an anchor');
|
|
475
|
+
const toggle = c.element('button', {
|
|
476
|
+
type: 'button',
|
|
477
|
+
class: 'jodit-link-anchors__toggle',
|
|
478
|
+
title: label,
|
|
479
|
+
'aria-label': label
|
|
480
|
+
});
|
|
481
|
+
const heading = c.div('jodit-link-anchors__heading', {
|
|
482
|
+
id: 'jodit-link-anchors-' + uniqueUid()
|
|
483
|
+
});
|
|
484
|
+
const list = c.div('jodit-link-anchors', {
|
|
485
|
+
role: 'group',
|
|
486
|
+
'aria-labelledby': heading.id
|
|
487
|
+
});
|
|
488
|
+
const icon = (name) => {
|
|
489
|
+
var _a;
|
|
490
|
+
return (_a = Icon.makeIcon(jodit, {
|
|
491
|
+
name,
|
|
492
|
+
iconURL: '',
|
|
493
|
+
fill: '',
|
|
494
|
+
scale: undefined
|
|
495
|
+
})) !== null && _a !== void 0 ? _a : c.span();
|
|
496
|
+
};
|
|
497
|
+
const dropdown = new Popup(jodit).setMod('padding', false);
|
|
498
|
+
const items = [];
|
|
499
|
+
let filled = '';
|
|
500
|
+
const open = () => {
|
|
501
|
+
var _a;
|
|
502
|
+
if (dropdown.isOpened) {
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
// Clicks in the list then count as the form's, which stays open
|
|
506
|
+
dropdown.parentElement || (dropdown.parentElement = input);
|
|
507
|
+
list.style.minWidth = field.offsetWidth + 'px';
|
|
508
|
+
dropdown.open(() => position(field));
|
|
509
|
+
attr(toggle, 'aria-expanded', true);
|
|
510
|
+
items.forEach((item, index) => attr(item, 'aria-current', url.value === '#' + getAnchorName(anchors[index])));
|
|
511
|
+
(_a = list.querySelector('[aria-current=true]')) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
|
|
512
|
+
block: 'nearest'
|
|
513
|
+
});
|
|
514
|
+
};
|
|
515
|
+
toggle.append(icon('chevron'));
|
|
516
|
+
attr(toggle, 'aria-expanded', false);
|
|
517
|
+
heading.textContent = jodit.i18n('On this page');
|
|
518
|
+
list.appendChild(heading);
|
|
519
|
+
dropdown.setContent(list);
|
|
520
|
+
anchors.forEach(anchor => {
|
|
521
|
+
const name = getAnchorName(anchor);
|
|
522
|
+
const text = textAfter(jodit, anchor) || name;
|
|
523
|
+
const item = c.element('button', {
|
|
524
|
+
type: 'button',
|
|
525
|
+
tabindex: -1,
|
|
526
|
+
class: 'jodit-link-anchors__item'
|
|
527
|
+
});
|
|
528
|
+
items.push(item);
|
|
529
|
+
const textBox = c.span('jodit-link-anchors__text');
|
|
530
|
+
textBox.textContent = text;
|
|
531
|
+
const nameBox = c.span('jodit-link-anchors__name');
|
|
532
|
+
nameBox.textContent = '#' + name;
|
|
533
|
+
item.append(icon('anchor'), textBox, nameBox);
|
|
534
|
+
list.appendChild(item);
|
|
535
|
+
jodit.e.on(item, 'click', () => {
|
|
536
|
+
dropdown.close();
|
|
537
|
+
url.value = '#' + name;
|
|
538
|
+
if (!isImage &&
|
|
539
|
+
(!content.value.trim() || content.value === filled)) {
|
|
540
|
+
content.value = filled = text;
|
|
541
|
+
}
|
|
542
|
+
url.focus();
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
// A press on the arrow closes the open list before the click
|
|
546
|
+
let wasOpen = false;
|
|
547
|
+
jodit.e
|
|
548
|
+
.on(dropdown, 'beforeClose', () => attr(toggle, 'aria-expanded', false))
|
|
549
|
+
.on(toggle, 'mousedown', () => (wasOpen = dropdown.isOpened))
|
|
550
|
+
.on(toggle, 'click', () => {
|
|
551
|
+
wasOpen || dropdown.isOpened ? dropdown.close() : open();
|
|
552
|
+
wasOpen = false;
|
|
553
|
+
})
|
|
554
|
+
.on(url, 'input.anchors', () => {
|
|
555
|
+
if (url.value && !url.value.startsWith('#')) {
|
|
556
|
+
dropdown.close();
|
|
557
|
+
}
|
|
558
|
+
})
|
|
559
|
+
.on(url, 'keydown.anchors', (e) => {
|
|
560
|
+
if (e.key === KEY_DOWN) {
|
|
561
|
+
e.preventDefault();
|
|
562
|
+
open();
|
|
563
|
+
items[0].focus();
|
|
564
|
+
}
|
|
565
|
+
if (e.key === KEY_ESC && dropdown.isOpened) {
|
|
566
|
+
e.stopPropagation();
|
|
567
|
+
dropdown.close();
|
|
568
|
+
}
|
|
569
|
+
})
|
|
570
|
+
.on(list, 'keydown', (e) => {
|
|
571
|
+
var _a;
|
|
572
|
+
const index = items.indexOf(e.target);
|
|
573
|
+
if (e.key === KEY_DOWN || e.key === KEY_UP) {
|
|
574
|
+
e.preventDefault();
|
|
575
|
+
(_a = items[index + (e.key === KEY_DOWN ? 1 : -1)]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
576
|
+
}
|
|
577
|
+
if (e.key === KEY_ESC) {
|
|
578
|
+
e.stopPropagation();
|
|
579
|
+
dropdown.close();
|
|
580
|
+
url.focus();
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
// The URL input is destructed when the form closes
|
|
584
|
+
input.hookStatus('destructed', () => {
|
|
585
|
+
dropdown.destruct();
|
|
586
|
+
jodit.e.off([toggle, list, ...items]).off(url, '.anchors');
|
|
587
|
+
});
|
|
588
|
+
Dom.after(url, toggle);
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* The words after an anchor in its block, which say where it is
|
|
592
|
+
*/
|
|
593
|
+
function textAfter(jodit, anchor) {
|
|
594
|
+
var _a;
|
|
595
|
+
const range = jodit.ed.createRange();
|
|
596
|
+
range.selectNodeContents((_a = Dom.up(anchor, Dom.isBlock, jodit.editor)) !== null && _a !== void 0 ? _a : jodit.editor);
|
|
597
|
+
range.setStartAfter(anchor);
|
|
598
|
+
const text = range.toString().replace(/\s+/g, ' ').trim();
|
|
599
|
+
return text.length > 50
|
|
600
|
+
? text.slice(0, 50).replace(/\s+\S*$/, '') + '…'
|
|
601
|
+
: text;
|
|
602
|
+
}
|
|
456
603
|
/**
|
|
457
604
|
* Guess a usable `href` from the selected text for the link dialog.
|
|
458
605
|
* Returns an empty string when the text is not a plausible URL/email,
|
|
@@ -11,7 +11,9 @@ export const formTemplate = (editor) => {
|
|
|
11
11
|
new UIBlock(editor, [
|
|
12
12
|
new UIInput(editor, {
|
|
13
13
|
name: 'url',
|
|
14
|
-
|
|
14
|
+
// Touch keyboards leave a URL field as typed, with no capital or
|
|
15
|
+
// correction. The form is `novalidate`, so any address still goes in
|
|
16
|
+
type: 'url',
|
|
15
17
|
ref: 'url_input',
|
|
16
18
|
label: 'URL',
|
|
17
19
|
placeholder: 'http://',
|
|
@@ -30,6 +30,12 @@ export declare class resizer extends Plugin {
|
|
|
30
30
|
private sizeViewer;
|
|
31
31
|
/** @override */
|
|
32
32
|
protected afterInit(editor: IJodit): void;
|
|
33
|
+
/**
|
|
34
|
+
* A tap that selects an image sends no `click` (iPadOS), so `touchend`
|
|
35
|
+
* stands in for it. A tick later, after `onClickOutside` has had the same
|
|
36
|
+
* `touchend`, as `click` comes after `mouseup`
|
|
37
|
+
*/
|
|
38
|
+
protected onEditorTouchEnd(e: TouchEvent): void;
|
|
33
39
|
/**
|
|
34
40
|
* Click in the editor area
|
|
35
41
|
*/
|