@ckeditor/ckeditor5-horizontal-line 39.0.1 → 40.0.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/LICENSE.md +1 -1
- package/README.md +3 -3
- package/build/horizontal-line.js.map +1 -0
- package/lang/translations/ar.po +1 -0
- package/lang/translations/az.po +1 -0
- package/lang/translations/bg.po +1 -0
- package/lang/translations/bn.po +1 -0
- package/lang/translations/bs.po +1 -0
- package/lang/translations/ca.po +1 -0
- package/lang/translations/cs.po +1 -0
- package/lang/translations/da.po +1 -0
- package/lang/translations/de-ch.po +1 -0
- package/lang/translations/de.po +1 -0
- package/lang/translations/el.po +1 -0
- package/lang/translations/en-au.po +1 -0
- package/lang/translations/en.po +1 -0
- package/lang/translations/es.po +1 -0
- package/lang/translations/et.po +1 -0
- package/lang/translations/fa.po +1 -0
- package/lang/translations/fi.po +1 -0
- package/lang/translations/fr.po +1 -0
- package/lang/translations/gl.po +1 -0
- package/lang/translations/he.po +1 -0
- package/lang/translations/hi.po +1 -0
- package/lang/translations/hr.po +1 -0
- package/lang/translations/hu.po +1 -0
- package/lang/translations/id.po +1 -0
- package/lang/translations/it.po +1 -0
- package/lang/translations/ja.po +1 -0
- package/lang/translations/jv.po +1 -0
- package/lang/translations/ko.po +1 -0
- package/lang/translations/ku.po +1 -0
- package/lang/translations/lt.po +1 -0
- package/lang/translations/lv.po +1 -0
- package/lang/translations/ms.po +1 -0
- package/lang/translations/nl.po +1 -0
- package/lang/translations/no.po +1 -0
- package/lang/translations/pl.po +1 -0
- package/lang/translations/pt-br.po +1 -0
- package/lang/translations/pt.po +1 -0
- package/lang/translations/ro.po +1 -0
- package/lang/translations/ru.po +1 -0
- package/lang/translations/sk.po +1 -0
- package/lang/translations/sl.po +1 -0
- package/lang/translations/sq.po +1 -0
- package/lang/translations/sr-latn.po +1 -0
- package/lang/translations/sr.po +1 -0
- package/lang/translations/sv.po +1 -0
- package/lang/translations/th.po +1 -0
- package/lang/translations/tk.po +1 -0
- package/lang/translations/tr.po +1 -0
- package/lang/translations/ug.po +1 -0
- package/lang/translations/uk.po +1 -0
- package/lang/translations/ur.po +1 -0
- package/lang/translations/uz.po +1 -0
- package/lang/translations/vi.po +1 -0
- package/lang/translations/zh-cn.po +1 -0
- package/lang/translations/zh.po +1 -0
- package/package.json +2 -6
- package/src/augmentation.d.ts +15 -15
- package/src/augmentation.js +5 -5
- package/src/horizontalline.d.ts +28 -28
- package/src/horizontalline.js +32 -32
- package/src/horizontallinecommand.d.ts +28 -28
- package/src/horizontallinecommand.js +63 -63
- package/src/horizontallineediting.d.ts +22 -22
- package/src/horizontallineediting.js +64 -64
- package/src/horizontallineui.d.ts +21 -21
- package/src/horizontallineui.js +45 -45
- package/src/index.d.ts +12 -12
- package/src/index.js +11 -11
package/lang/translations/zh.po
CHANGED
@@ -15,6 +15,7 @@ msgstr ""
|
|
15
15
|
"Language-Team: Chinese (Taiwan) (https://app.transifex.com/ckeditor/teams/11143/zh_TW/)\n"
|
16
16
|
"Language: zh_TW\n"
|
17
17
|
"Plural-Forms: nplurals=1; plural=0;\n"
|
18
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
18
19
|
|
19
20
|
msgctxt "Horizontal line"
|
20
21
|
msgid "Horizontal line"
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-horizontal-line",
|
3
|
-
"version": "
|
3
|
+
"version": "40.0.0",
|
4
4
|
"description": "Horizontal line feature for CKEditor 5.",
|
5
5
|
"keywords": [
|
6
6
|
"ckeditor",
|
@@ -12,11 +12,7 @@
|
|
12
12
|
],
|
13
13
|
"main": "src/index.js",
|
14
14
|
"dependencies": {
|
15
|
-
"ckeditor5": "
|
16
|
-
},
|
17
|
-
"engines": {
|
18
|
-
"node": ">=16.0.0",
|
19
|
-
"npm": ">=5.7.1"
|
15
|
+
"ckeditor5": "40.0.0"
|
20
16
|
},
|
21
17
|
"author": "CKSource (http://cksource.com/)",
|
22
18
|
"license": "GPL-2.0-or-later",
|
package/src/augmentation.d.ts
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
import type { HorizontalLine, HorizontalLineCommand, HorizontalLineEditing, HorizontalLineUI } from './index';
|
6
|
-
declare module '@ckeditor/ckeditor5-core' {
|
7
|
-
interface PluginsMap {
|
8
|
-
[HorizontalLine.pluginName]: HorizontalLine;
|
9
|
-
[HorizontalLineEditing.pluginName]: HorizontalLineEditing;
|
10
|
-
[HorizontalLineUI.pluginName]: HorizontalLineUI;
|
11
|
-
}
|
12
|
-
interface CommandsMap {
|
13
|
-
horizontalLine: HorizontalLineCommand;
|
14
|
-
}
|
15
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
import type { HorizontalLine, HorizontalLineCommand, HorizontalLineEditing, HorizontalLineUI } from './index';
|
6
|
+
declare module '@ckeditor/ckeditor5-core' {
|
7
|
+
interface PluginsMap {
|
8
|
+
[HorizontalLine.pluginName]: HorizontalLine;
|
9
|
+
[HorizontalLineEditing.pluginName]: HorizontalLineEditing;
|
10
|
+
[HorizontalLineUI.pluginName]: HorizontalLineUI;
|
11
|
+
}
|
12
|
+
interface CommandsMap {
|
13
|
+
horizontalLine: HorizontalLineCommand;
|
14
|
+
}
|
15
|
+
}
|
package/src/augmentation.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
export {};
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
export {};
|
package/src/horizontalline.d.ts
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module horizontal-line/horizontalline
|
7
|
-
*/
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
9
|
-
import { Widget } from 'ckeditor5/src/widget';
|
10
|
-
import HorizontalLineEditing from './horizontallineediting';
|
11
|
-
import HorizontalLineUI from './horizontallineui';
|
12
|
-
/**
|
13
|
-
* The horizontal line feature.
|
14
|
-
*
|
15
|
-
* It provides the possibility to insert a horizontal line into the rich-text editor.
|
16
|
-
*
|
17
|
-
* For a detailed overview, check the {@glink features/horizontal-line Horizontal line feature} documentation.
|
18
|
-
*/
|
19
|
-
export default class HorizontalLine extends Plugin {
|
20
|
-
/**
|
21
|
-
* @inheritDoc
|
22
|
-
*/
|
23
|
-
static get requires(): readonly [typeof HorizontalLineEditing, typeof HorizontalLineUI, typeof Widget];
|
24
|
-
/**
|
25
|
-
* @inheritDoc
|
26
|
-
*/
|
27
|
-
static get pluginName(): "HorizontalLine";
|
28
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module horizontal-line/horizontalline
|
7
|
+
*/
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
9
|
+
import { Widget } from 'ckeditor5/src/widget';
|
10
|
+
import HorizontalLineEditing from './horizontallineediting';
|
11
|
+
import HorizontalLineUI from './horizontallineui';
|
12
|
+
/**
|
13
|
+
* The horizontal line feature.
|
14
|
+
*
|
15
|
+
* It provides the possibility to insert a horizontal line into the rich-text editor.
|
16
|
+
*
|
17
|
+
* For a detailed overview, check the {@glink features/horizontal-line Horizontal line feature} documentation.
|
18
|
+
*/
|
19
|
+
export default class HorizontalLine extends Plugin {
|
20
|
+
/**
|
21
|
+
* @inheritDoc
|
22
|
+
*/
|
23
|
+
static get requires(): readonly [typeof HorizontalLineEditing, typeof HorizontalLineUI, typeof Widget];
|
24
|
+
/**
|
25
|
+
* @inheritDoc
|
26
|
+
*/
|
27
|
+
static get pluginName(): "HorizontalLine";
|
28
|
+
}
|
package/src/horizontalline.js
CHANGED
@@ -1,32 +1,32 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module horizontal-line/horizontalline
|
7
|
-
*/
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
9
|
-
import { Widget } from 'ckeditor5/src/widget';
|
10
|
-
import HorizontalLineEditing from './horizontallineediting';
|
11
|
-
import HorizontalLineUI from './horizontallineui';
|
12
|
-
/**
|
13
|
-
* The horizontal line feature.
|
14
|
-
*
|
15
|
-
* It provides the possibility to insert a horizontal line into the rich-text editor.
|
16
|
-
*
|
17
|
-
* For a detailed overview, check the {@glink features/horizontal-line Horizontal line feature} documentation.
|
18
|
-
*/
|
19
|
-
export default class HorizontalLine extends Plugin {
|
20
|
-
/**
|
21
|
-
* @inheritDoc
|
22
|
-
*/
|
23
|
-
static get requires() {
|
24
|
-
return [HorizontalLineEditing, HorizontalLineUI, Widget];
|
25
|
-
}
|
26
|
-
/**
|
27
|
-
* @inheritDoc
|
28
|
-
*/
|
29
|
-
static get pluginName() {
|
30
|
-
return 'HorizontalLine';
|
31
|
-
}
|
32
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module horizontal-line/horizontalline
|
7
|
+
*/
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
9
|
+
import { Widget } from 'ckeditor5/src/widget';
|
10
|
+
import HorizontalLineEditing from './horizontallineediting';
|
11
|
+
import HorizontalLineUI from './horizontallineui';
|
12
|
+
/**
|
13
|
+
* The horizontal line feature.
|
14
|
+
*
|
15
|
+
* It provides the possibility to insert a horizontal line into the rich-text editor.
|
16
|
+
*
|
17
|
+
* For a detailed overview, check the {@glink features/horizontal-line Horizontal line feature} documentation.
|
18
|
+
*/
|
19
|
+
export default class HorizontalLine extends Plugin {
|
20
|
+
/**
|
21
|
+
* @inheritDoc
|
22
|
+
*/
|
23
|
+
static get requires() {
|
24
|
+
return [HorizontalLineEditing, HorizontalLineUI, Widget];
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* @inheritDoc
|
28
|
+
*/
|
29
|
+
static get pluginName() {
|
30
|
+
return 'HorizontalLine';
|
31
|
+
}
|
32
|
+
}
|
@@ -1,28 +1,28 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
import { Command } from 'ckeditor5/src/core';
|
6
|
-
/**
|
7
|
-
* The horizontal line command.
|
8
|
-
*
|
9
|
-
* The command is registered by {@link module:horizontal-line/horizontallineediting~HorizontalLineEditing} as `'horizontalLine'`.
|
10
|
-
*
|
11
|
-
* To insert a horizontal line at the current selection, execute the command:
|
12
|
-
*
|
13
|
-
* ```ts
|
14
|
-
* editor.execute( 'horizontalLine' );
|
15
|
-
* ```
|
16
|
-
*/
|
17
|
-
export default class HorizontalLineCommand extends Command {
|
18
|
-
/**
|
19
|
-
* @inheritDoc
|
20
|
-
*/
|
21
|
-
refresh(): void;
|
22
|
-
/**
|
23
|
-
* Executes the command.
|
24
|
-
*
|
25
|
-
* @fires execute
|
26
|
-
*/
|
27
|
-
execute(): void;
|
28
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
import { Command } from 'ckeditor5/src/core';
|
6
|
+
/**
|
7
|
+
* The horizontal line command.
|
8
|
+
*
|
9
|
+
* The command is registered by {@link module:horizontal-line/horizontallineediting~HorizontalLineEditing} as `'horizontalLine'`.
|
10
|
+
*
|
11
|
+
* To insert a horizontal line at the current selection, execute the command:
|
12
|
+
*
|
13
|
+
* ```ts
|
14
|
+
* editor.execute( 'horizontalLine' );
|
15
|
+
* ```
|
16
|
+
*/
|
17
|
+
export default class HorizontalLineCommand extends Command {
|
18
|
+
/**
|
19
|
+
* @inheritDoc
|
20
|
+
*/
|
21
|
+
refresh(): void;
|
22
|
+
/**
|
23
|
+
* Executes the command.
|
24
|
+
*
|
25
|
+
* @fires execute
|
26
|
+
*/
|
27
|
+
execute(): void;
|
28
|
+
}
|
@@ -1,63 +1,63 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
import { Command } from 'ckeditor5/src/core';
|
6
|
-
import { findOptimalInsertionRange } from 'ckeditor5/src/widget';
|
7
|
-
/**
|
8
|
-
* The horizontal line command.
|
9
|
-
*
|
10
|
-
* The command is registered by {@link module:horizontal-line/horizontallineediting~HorizontalLineEditing} as `'horizontalLine'`.
|
11
|
-
*
|
12
|
-
* To insert a horizontal line at the current selection, execute the command:
|
13
|
-
*
|
14
|
-
* ```ts
|
15
|
-
* editor.execute( 'horizontalLine' );
|
16
|
-
* ```
|
17
|
-
*/
|
18
|
-
export default class HorizontalLineCommand extends Command {
|
19
|
-
/**
|
20
|
-
* @inheritDoc
|
21
|
-
*/
|
22
|
-
refresh() {
|
23
|
-
const model = this.editor.model;
|
24
|
-
const schema = model.schema;
|
25
|
-
const selection = model.document.selection;
|
26
|
-
this.isEnabled = isHorizontalLineAllowedInParent(selection, schema, model);
|
27
|
-
}
|
28
|
-
/**
|
29
|
-
* Executes the command.
|
30
|
-
*
|
31
|
-
* @fires execute
|
32
|
-
*/
|
33
|
-
execute() {
|
34
|
-
const model = this.editor.model;
|
35
|
-
model.change(writer => {
|
36
|
-
const horizontalElement = writer.createElement('horizontalLine');
|
37
|
-
model.insertObject(horizontalElement, null, null, { setSelection: 'after' });
|
38
|
-
});
|
39
|
-
}
|
40
|
-
}
|
41
|
-
/**
|
42
|
-
* Checks if a horizontal line is allowed by the schema in the optimal insertion parent.
|
43
|
-
*
|
44
|
-
* @param model Model instance.
|
45
|
-
*/
|
46
|
-
function isHorizontalLineAllowedInParent(selection, schema, model) {
|
47
|
-
const parent = getInsertHorizontalLineParent(selection, model);
|
48
|
-
return schema.checkChild(parent, 'horizontalLine');
|
49
|
-
}
|
50
|
-
/**
|
51
|
-
* Returns a node that will be used to insert a horizontal line with `model.insertContent` to check if the horizontal line can be
|
52
|
-
* placed there.
|
53
|
-
*
|
54
|
-
* @param model Model instance.
|
55
|
-
*/
|
56
|
-
function getInsertHorizontalLineParent(selection, model) {
|
57
|
-
const insertionRange = findOptimalInsertionRange(selection, model);
|
58
|
-
const parent = insertionRange.start.parent;
|
59
|
-
if (parent.isEmpty && !parent.is('element', '$root')) {
|
60
|
-
return parent.parent;
|
61
|
-
}
|
62
|
-
return parent;
|
63
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
import { Command } from 'ckeditor5/src/core';
|
6
|
+
import { findOptimalInsertionRange } from 'ckeditor5/src/widget';
|
7
|
+
/**
|
8
|
+
* The horizontal line command.
|
9
|
+
*
|
10
|
+
* The command is registered by {@link module:horizontal-line/horizontallineediting~HorizontalLineEditing} as `'horizontalLine'`.
|
11
|
+
*
|
12
|
+
* To insert a horizontal line at the current selection, execute the command:
|
13
|
+
*
|
14
|
+
* ```ts
|
15
|
+
* editor.execute( 'horizontalLine' );
|
16
|
+
* ```
|
17
|
+
*/
|
18
|
+
export default class HorizontalLineCommand extends Command {
|
19
|
+
/**
|
20
|
+
* @inheritDoc
|
21
|
+
*/
|
22
|
+
refresh() {
|
23
|
+
const model = this.editor.model;
|
24
|
+
const schema = model.schema;
|
25
|
+
const selection = model.document.selection;
|
26
|
+
this.isEnabled = isHorizontalLineAllowedInParent(selection, schema, model);
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Executes the command.
|
30
|
+
*
|
31
|
+
* @fires execute
|
32
|
+
*/
|
33
|
+
execute() {
|
34
|
+
const model = this.editor.model;
|
35
|
+
model.change(writer => {
|
36
|
+
const horizontalElement = writer.createElement('horizontalLine');
|
37
|
+
model.insertObject(horizontalElement, null, null, { setSelection: 'after' });
|
38
|
+
});
|
39
|
+
}
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* Checks if a horizontal line is allowed by the schema in the optimal insertion parent.
|
43
|
+
*
|
44
|
+
* @param model Model instance.
|
45
|
+
*/
|
46
|
+
function isHorizontalLineAllowedInParent(selection, schema, model) {
|
47
|
+
const parent = getInsertHorizontalLineParent(selection, model);
|
48
|
+
return schema.checkChild(parent, 'horizontalLine');
|
49
|
+
}
|
50
|
+
/**
|
51
|
+
* Returns a node that will be used to insert a horizontal line with `model.insertContent` to check if the horizontal line can be
|
52
|
+
* placed there.
|
53
|
+
*
|
54
|
+
* @param model Model instance.
|
55
|
+
*/
|
56
|
+
function getInsertHorizontalLineParent(selection, model) {
|
57
|
+
const insertionRange = findOptimalInsertionRange(selection, model);
|
58
|
+
const parent = insertionRange.start.parent;
|
59
|
+
if (parent.isEmpty && !parent.is('element', '$root')) {
|
60
|
+
return parent.parent;
|
61
|
+
}
|
62
|
+
return parent;
|
63
|
+
}
|
@@ -1,22 +1,22 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module horizontal-line/horizontallineediting
|
7
|
-
*/
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
9
|
-
import '../theme/horizontalline.css';
|
10
|
-
/**
|
11
|
-
* The horizontal line editing feature.
|
12
|
-
*/
|
13
|
-
export default class HorizontalLineEditing extends Plugin {
|
14
|
-
/**
|
15
|
-
* @inheritDoc
|
16
|
-
*/
|
17
|
-
static get pluginName(): "HorizontalLineEditing";
|
18
|
-
/**
|
19
|
-
* @inheritDoc
|
20
|
-
*/
|
21
|
-
init(): void;
|
22
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module horizontal-line/horizontallineediting
|
7
|
+
*/
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
9
|
+
import '../theme/horizontalline.css';
|
10
|
+
/**
|
11
|
+
* The horizontal line editing feature.
|
12
|
+
*/
|
13
|
+
export default class HorizontalLineEditing extends Plugin {
|
14
|
+
/**
|
15
|
+
* @inheritDoc
|
16
|
+
*/
|
17
|
+
static get pluginName(): "HorizontalLineEditing";
|
18
|
+
/**
|
19
|
+
* @inheritDoc
|
20
|
+
*/
|
21
|
+
init(): void;
|
22
|
+
}
|
@@ -1,64 +1,64 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module horizontal-line/horizontallineediting
|
7
|
-
*/
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
9
|
-
import { toWidget } from 'ckeditor5/src/widget';
|
10
|
-
import HorizontalLineCommand from './horizontallinecommand';
|
11
|
-
import '../theme/horizontalline.css';
|
12
|
-
/**
|
13
|
-
* The horizontal line editing feature.
|
14
|
-
*/
|
15
|
-
export default class HorizontalLineEditing extends Plugin {
|
16
|
-
/**
|
17
|
-
* @inheritDoc
|
18
|
-
*/
|
19
|
-
static get pluginName() {
|
20
|
-
return 'HorizontalLineEditing';
|
21
|
-
}
|
22
|
-
/**
|
23
|
-
* @inheritDoc
|
24
|
-
*/
|
25
|
-
init() {
|
26
|
-
const editor = this.editor;
|
27
|
-
const schema = editor.model.schema;
|
28
|
-
const t = editor.t;
|
29
|
-
const conversion = editor.conversion;
|
30
|
-
schema.register('horizontalLine', {
|
31
|
-
inheritAllFrom: '$blockObject'
|
32
|
-
});
|
33
|
-
conversion.for('dataDowncast').elementToElement({
|
34
|
-
model: 'horizontalLine',
|
35
|
-
view: (modelElement, { writer }) => {
|
36
|
-
return writer.createEmptyElement('hr');
|
37
|
-
}
|
38
|
-
});
|
39
|
-
conversion.for('editingDowncast').elementToStructure({
|
40
|
-
model: 'horizontalLine',
|
41
|
-
view: (modelElement, { writer }) => {
|
42
|
-
const label = t('Horizontal line');
|
43
|
-
const viewWrapper = writer.createContainerElement('div', null, writer.createEmptyElement('hr'));
|
44
|
-
writer.addClass('ck-horizontal-line', viewWrapper);
|
45
|
-
writer.setCustomProperty('hr', true, viewWrapper);
|
46
|
-
return toHorizontalLineWidget(viewWrapper, writer, label);
|
47
|
-
}
|
48
|
-
});
|
49
|
-
conversion.for('upcast').elementToElement({ view: 'hr', model: 'horizontalLine' });
|
50
|
-
editor.commands.add('horizontalLine', new HorizontalLineCommand(editor));
|
51
|
-
}
|
52
|
-
}
|
53
|
-
/**
|
54
|
-
* Converts a given {@link module:engine/view/element~Element} to a horizontal line widget:
|
55
|
-
* * Adds a {@link module:engine/view/element~Element#_setCustomProperty custom property} allowing to
|
56
|
-
* recognize the horizontal line widget element.
|
57
|
-
* * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.
|
58
|
-
*
|
59
|
-
* @param writer An instance of the view writer.
|
60
|
-
*/
|
61
|
-
function toHorizontalLineWidget(viewElement, writer, label) {
|
62
|
-
writer.setCustomProperty('horizontalLine', true, viewElement);
|
63
|
-
return toWidget(viewElement, writer, { label });
|
64
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module horizontal-line/horizontallineediting
|
7
|
+
*/
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
9
|
+
import { toWidget } from 'ckeditor5/src/widget';
|
10
|
+
import HorizontalLineCommand from './horizontallinecommand';
|
11
|
+
import '../theme/horizontalline.css';
|
12
|
+
/**
|
13
|
+
* The horizontal line editing feature.
|
14
|
+
*/
|
15
|
+
export default class HorizontalLineEditing extends Plugin {
|
16
|
+
/**
|
17
|
+
* @inheritDoc
|
18
|
+
*/
|
19
|
+
static get pluginName() {
|
20
|
+
return 'HorizontalLineEditing';
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* @inheritDoc
|
24
|
+
*/
|
25
|
+
init() {
|
26
|
+
const editor = this.editor;
|
27
|
+
const schema = editor.model.schema;
|
28
|
+
const t = editor.t;
|
29
|
+
const conversion = editor.conversion;
|
30
|
+
schema.register('horizontalLine', {
|
31
|
+
inheritAllFrom: '$blockObject'
|
32
|
+
});
|
33
|
+
conversion.for('dataDowncast').elementToElement({
|
34
|
+
model: 'horizontalLine',
|
35
|
+
view: (modelElement, { writer }) => {
|
36
|
+
return writer.createEmptyElement('hr');
|
37
|
+
}
|
38
|
+
});
|
39
|
+
conversion.for('editingDowncast').elementToStructure({
|
40
|
+
model: 'horizontalLine',
|
41
|
+
view: (modelElement, { writer }) => {
|
42
|
+
const label = t('Horizontal line');
|
43
|
+
const viewWrapper = writer.createContainerElement('div', null, writer.createEmptyElement('hr'));
|
44
|
+
writer.addClass('ck-horizontal-line', viewWrapper);
|
45
|
+
writer.setCustomProperty('hr', true, viewWrapper);
|
46
|
+
return toHorizontalLineWidget(viewWrapper, writer, label);
|
47
|
+
}
|
48
|
+
});
|
49
|
+
conversion.for('upcast').elementToElement({ view: 'hr', model: 'horizontalLine' });
|
50
|
+
editor.commands.add('horizontalLine', new HorizontalLineCommand(editor));
|
51
|
+
}
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* Converts a given {@link module:engine/view/element~Element} to a horizontal line widget:
|
55
|
+
* * Adds a {@link module:engine/view/element~Element#_setCustomProperty custom property} allowing to
|
56
|
+
* recognize the horizontal line widget element.
|
57
|
+
* * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.
|
58
|
+
*
|
59
|
+
* @param writer An instance of the view writer.
|
60
|
+
*/
|
61
|
+
function toHorizontalLineWidget(viewElement, writer, label) {
|
62
|
+
writer.setCustomProperty('horizontalLine', true, viewElement);
|
63
|
+
return toWidget(viewElement, writer, { label });
|
64
|
+
}
|
@@ -1,21 +1,21 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* @module horizontal-line/horizontallineui
|
7
|
-
*/
|
8
|
-
import { Plugin } from 'ckeditor5/src/core';
|
9
|
-
/**
|
10
|
-
* The horizontal line UI plugin.
|
11
|
-
*/
|
12
|
-
export default class HorizontalLineUI extends Plugin {
|
13
|
-
/**
|
14
|
-
* @inheritDoc
|
15
|
-
*/
|
16
|
-
static get pluginName(): "HorizontalLineUI";
|
17
|
-
/**
|
18
|
-
* @inheritDoc
|
19
|
-
*/
|
20
|
-
init(): void;
|
21
|
-
}
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @module horizontal-line/horizontallineui
|
7
|
+
*/
|
8
|
+
import { Plugin } from 'ckeditor5/src/core';
|
9
|
+
/**
|
10
|
+
* The horizontal line UI plugin.
|
11
|
+
*/
|
12
|
+
export default class HorizontalLineUI extends Plugin {
|
13
|
+
/**
|
14
|
+
* @inheritDoc
|
15
|
+
*/
|
16
|
+
static get pluginName(): "HorizontalLineUI";
|
17
|
+
/**
|
18
|
+
* @inheritDoc
|
19
|
+
*/
|
20
|
+
init(): void;
|
21
|
+
}
|