@ckeditor/ckeditor5-page-break 0.0.0-nightly-20260118.0 → 0.0.0-nightly-next-20260118.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/ckeditor5-metadata.json +1 -1
- package/dist/index.js.map +1 -1
- package/{src → dist}/pagebreak.d.ts +2 -2
- package/{src → dist}/pagebreakcommand.d.ts +1 -1
- package/{src → dist}/pagebreakediting.d.ts +1 -1
- package/{src → dist}/pagebreakui.d.ts +1 -1
- package/package.json +24 -47
- package/build/page-break.js +0 -5
- package/build/translations/af.js +0 -1
- package/build/translations/ar.js +0 -1
- package/build/translations/ast.js +0 -1
- package/build/translations/az.js +0 -1
- package/build/translations/be.js +0 -1
- package/build/translations/bg.js +0 -1
- package/build/translations/bn.js +0 -1
- package/build/translations/bs.js +0 -1
- package/build/translations/ca.js +0 -1
- package/build/translations/cs.js +0 -1
- package/build/translations/da.js +0 -1
- package/build/translations/de-ch.js +0 -1
- package/build/translations/de.js +0 -1
- package/build/translations/el.js +0 -1
- package/build/translations/en-au.js +0 -1
- package/build/translations/en-gb.js +0 -1
- package/build/translations/eo.js +0 -1
- package/build/translations/es-co.js +0 -1
- package/build/translations/es.js +0 -1
- package/build/translations/et.js +0 -1
- package/build/translations/eu.js +0 -1
- package/build/translations/fa.js +0 -1
- package/build/translations/fi.js +0 -1
- package/build/translations/fr.js +0 -1
- package/build/translations/gl.js +0 -1
- package/build/translations/gu.js +0 -1
- package/build/translations/he.js +0 -1
- package/build/translations/hi.js +0 -1
- package/build/translations/hr.js +0 -1
- package/build/translations/hu.js +0 -1
- package/build/translations/hy.js +0 -1
- package/build/translations/id.js +0 -1
- package/build/translations/it.js +0 -1
- package/build/translations/ja.js +0 -1
- package/build/translations/jv.js +0 -1
- package/build/translations/kk.js +0 -1
- package/build/translations/km.js +0 -1
- package/build/translations/kn.js +0 -1
- package/build/translations/ko.js +0 -1
- package/build/translations/ku.js +0 -1
- package/build/translations/lt.js +0 -1
- package/build/translations/lv.js +0 -1
- package/build/translations/ms.js +0 -1
- package/build/translations/nb.js +0 -1
- package/build/translations/ne.js +0 -1
- package/build/translations/nl.js +0 -1
- package/build/translations/no.js +0 -1
- package/build/translations/oc.js +0 -1
- package/build/translations/pl.js +0 -1
- package/build/translations/pt-br.js +0 -1
- package/build/translations/pt.js +0 -1
- package/build/translations/ro.js +0 -1
- package/build/translations/ru.js +0 -1
- package/build/translations/si.js +0 -1
- package/build/translations/sk.js +0 -1
- package/build/translations/sl.js +0 -1
- package/build/translations/sq.js +0 -1
- package/build/translations/sr-latn.js +0 -1
- package/build/translations/sr.js +0 -1
- package/build/translations/sv.js +0 -1
- package/build/translations/th.js +0 -1
- package/build/translations/ti.js +0 -1
- package/build/translations/tk.js +0 -1
- package/build/translations/tr.js +0 -1
- package/build/translations/tt.js +0 -1
- package/build/translations/ug.js +0 -1
- package/build/translations/uk.js +0 -1
- package/build/translations/ur.js +0 -1
- package/build/translations/uz.js +0 -1
- package/build/translations/vi.js +0 -1
- package/build/translations/zh-cn.js +0 -1
- package/build/translations/zh.js +0 -1
- package/lang/contexts.json +0 -3
- package/lang/translations/af.po +0 -16
- package/lang/translations/ar.po +0 -16
- package/lang/translations/ast.po +0 -16
- package/lang/translations/az.po +0 -16
- package/lang/translations/be.po +0 -16
- package/lang/translations/bg.po +0 -16
- package/lang/translations/bn.po +0 -16
- package/lang/translations/bs.po +0 -16
- package/lang/translations/ca.po +0 -16
- package/lang/translations/cs.po +0 -16
- package/lang/translations/da.po +0 -16
- package/lang/translations/de-ch.po +0 -16
- package/lang/translations/de.po +0 -16
- package/lang/translations/el.po +0 -16
- package/lang/translations/en-au.po +0 -16
- package/lang/translations/en-gb.po +0 -16
- package/lang/translations/en.po +0 -16
- package/lang/translations/eo.po +0 -16
- package/lang/translations/es-co.po +0 -16
- package/lang/translations/es.po +0 -16
- package/lang/translations/et.po +0 -16
- package/lang/translations/eu.po +0 -16
- package/lang/translations/fa.po +0 -16
- package/lang/translations/fi.po +0 -16
- package/lang/translations/fr.po +0 -16
- package/lang/translations/gl.po +0 -16
- package/lang/translations/gu.po +0 -16
- package/lang/translations/he.po +0 -16
- package/lang/translations/hi.po +0 -16
- package/lang/translations/hr.po +0 -16
- package/lang/translations/hu.po +0 -16
- package/lang/translations/hy.po +0 -16
- package/lang/translations/id.po +0 -16
- package/lang/translations/it.po +0 -16
- package/lang/translations/ja.po +0 -16
- package/lang/translations/jv.po +0 -16
- package/lang/translations/kk.po +0 -16
- package/lang/translations/km.po +0 -16
- package/lang/translations/kn.po +0 -16
- package/lang/translations/ko.po +0 -16
- package/lang/translations/ku.po +0 -16
- package/lang/translations/lt.po +0 -16
- package/lang/translations/lv.po +0 -16
- package/lang/translations/ms.po +0 -16
- package/lang/translations/nb.po +0 -16
- package/lang/translations/ne.po +0 -16
- package/lang/translations/nl.po +0 -16
- package/lang/translations/no.po +0 -16
- package/lang/translations/oc.po +0 -16
- package/lang/translations/pl.po +0 -16
- package/lang/translations/pt-br.po +0 -16
- package/lang/translations/pt.po +0 -16
- package/lang/translations/ro.po +0 -16
- package/lang/translations/ru.po +0 -16
- package/lang/translations/si.po +0 -16
- package/lang/translations/sk.po +0 -16
- package/lang/translations/sl.po +0 -16
- package/lang/translations/sq.po +0 -16
- package/lang/translations/sr-latn.po +0 -16
- package/lang/translations/sr.po +0 -16
- package/lang/translations/sv.po +0 -16
- package/lang/translations/th.po +0 -16
- package/lang/translations/ti.po +0 -16
- package/lang/translations/tk.po +0 -16
- package/lang/translations/tr.po +0 -16
- package/lang/translations/tt.po +0 -16
- package/lang/translations/ug.po +0 -16
- package/lang/translations/uk.po +0 -16
- package/lang/translations/ur.po +0 -16
- package/lang/translations/uz.po +0 -16
- package/lang/translations/vi.po +0 -16
- package/lang/translations/zh-cn.po +0 -16
- package/lang/translations/zh.po +0 -16
- package/src/augmentation.js +0 -5
- package/src/index.js +0 -12
- package/src/pagebreak.js +0 -38
- package/src/pagebreakcommand.js +0 -61
- package/src/pagebreakediting.js +0 -130
- package/src/pagebreakui.js +0 -63
- package/theme/pagebreak.css +0 -62
- /package/{src → dist}/augmentation.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
package/lang/translations/uz.po
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
-
#
|
|
3
|
-
# Want to contribute to this file? Submit your changes via a GitHub Pull Request.
|
|
4
|
-
#
|
|
5
|
-
# Check out the official contributor's guide:
|
|
6
|
-
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
7
|
-
#
|
|
8
|
-
msgid ""
|
|
9
|
-
msgstr ""
|
|
10
|
-
"Language: uz\n"
|
|
11
|
-
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
|
12
|
-
"Content-Type: text/plain; charset=UTF-8\n"
|
|
13
|
-
|
|
14
|
-
msgctxt "Page break"
|
|
15
|
-
msgid "Page break"
|
|
16
|
-
msgstr "Sahifalar uzilishi"
|
package/lang/translations/vi.po
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
-
#
|
|
3
|
-
# Want to contribute to this file? Submit your changes via a GitHub Pull Request.
|
|
4
|
-
#
|
|
5
|
-
# Check out the official contributor's guide:
|
|
6
|
-
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
7
|
-
#
|
|
8
|
-
msgid ""
|
|
9
|
-
msgstr ""
|
|
10
|
-
"Language: vi\n"
|
|
11
|
-
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
12
|
-
"Content-Type: text/plain; charset=UTF-8\n"
|
|
13
|
-
|
|
14
|
-
msgctxt "Page break"
|
|
15
|
-
msgid "Page break"
|
|
16
|
-
msgstr "Ngắt trang"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
-
#
|
|
3
|
-
# Want to contribute to this file? Submit your changes via a GitHub Pull Request.
|
|
4
|
-
#
|
|
5
|
-
# Check out the official contributor's guide:
|
|
6
|
-
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
7
|
-
#
|
|
8
|
-
msgid ""
|
|
9
|
-
msgstr ""
|
|
10
|
-
"Language: zh_CN\n"
|
|
11
|
-
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
12
|
-
"Content-Type: text/plain; charset=UTF-8\n"
|
|
13
|
-
|
|
14
|
-
msgctxt "Page break"
|
|
15
|
-
msgid "Page break"
|
|
16
|
-
msgstr "分页符"
|
package/lang/translations/zh.po
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
2
|
-
#
|
|
3
|
-
# Want to contribute to this file? Submit your changes via a GitHub Pull Request.
|
|
4
|
-
#
|
|
5
|
-
# Check out the official contributor's guide:
|
|
6
|
-
# https://ckeditor.com/docs/ckeditor5/latest/framework/guides/contributing/contributing.html
|
|
7
|
-
#
|
|
8
|
-
msgid ""
|
|
9
|
-
msgstr ""
|
|
10
|
-
"Language: zh_TW\n"
|
|
11
|
-
"Plural-Forms: nplurals=1; plural=0;\n"
|
|
12
|
-
"Content-Type: text/plain; charset=UTF-8\n"
|
|
13
|
-
|
|
14
|
-
msgctxt "Page break"
|
|
15
|
-
msgid "Page break"
|
|
16
|
-
msgstr "換頁"
|
package/src/augmentation.js
DELETED
package/src/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module page-break
|
|
7
|
-
*/
|
|
8
|
-
export { PageBreak } from './pagebreak.js';
|
|
9
|
-
export { PageBreakEditing } from './pagebreakediting.js';
|
|
10
|
-
export { PageBreakUI } from './pagebreakui.js';
|
|
11
|
-
export { PageBreakCommand } from './pagebreakcommand.js';
|
|
12
|
-
import './augmentation.js';
|
package/src/pagebreak.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module page-break/pagebreak
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { Widget } from 'ckeditor5/src/widget.js';
|
|
10
|
-
import { PageBreakEditing } from './pagebreakediting.js';
|
|
11
|
-
import { PageBreakUI } from './pagebreakui.js';
|
|
12
|
-
/**
|
|
13
|
-
* The page break feature.
|
|
14
|
-
*
|
|
15
|
-
* It provides the possibility to insert a page break into the rich-text editor.
|
|
16
|
-
*
|
|
17
|
-
* For a detailed overview, check the {@glink features/page-break Page break feature} documentation.
|
|
18
|
-
*/
|
|
19
|
-
export class PageBreak extends Plugin {
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
*/
|
|
23
|
-
static get requires() {
|
|
24
|
-
return [PageBreakEditing, PageBreakUI, Widget];
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* @inheritDoc
|
|
28
|
-
*/
|
|
29
|
-
static get pluginName() {
|
|
30
|
-
return 'PageBreak';
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @inheritDoc
|
|
34
|
-
*/
|
|
35
|
-
static get isOfficialPlugin() {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
}
|
package/src/pagebreakcommand.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module page-break/pagebreakcommand
|
|
7
|
-
*/
|
|
8
|
-
import { Command } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { findOptimalInsertionRange } from 'ckeditor5/src/widget.js';
|
|
10
|
-
/**
|
|
11
|
-
* The page break command.
|
|
12
|
-
*
|
|
13
|
-
* The command is registered by {@link module:page-break/pagebreakediting~PageBreakEditing} as `'pageBreak'`.
|
|
14
|
-
*
|
|
15
|
-
* To insert a page break at the current selection, execute the command:
|
|
16
|
-
*
|
|
17
|
-
* editor.execute( 'pageBreak' );
|
|
18
|
-
*/
|
|
19
|
-
export class PageBreakCommand extends Command {
|
|
20
|
-
/**
|
|
21
|
-
* @inheritDoc
|
|
22
|
-
*/
|
|
23
|
-
refresh() {
|
|
24
|
-
const model = this.editor.model;
|
|
25
|
-
const schema = model.schema;
|
|
26
|
-
const selection = model.document.selection;
|
|
27
|
-
this.isEnabled = isPageBreakAllowedInParent(selection, schema, model);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Executes the command.
|
|
31
|
-
*
|
|
32
|
-
* @fires execute
|
|
33
|
-
*/
|
|
34
|
-
execute() {
|
|
35
|
-
const model = this.editor.model;
|
|
36
|
-
model.change(writer => {
|
|
37
|
-
const pageBreakElement = writer.createElement('pageBreak');
|
|
38
|
-
model.insertObject(pageBreakElement, null, null, {
|
|
39
|
-
setSelection: 'after'
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Checks if a page break is allowed by the schema in the optimal insertion parent.
|
|
46
|
-
*/
|
|
47
|
-
function isPageBreakAllowedInParent(selection, schema, model) {
|
|
48
|
-
const parent = getInsertPageBreakParent(selection, model);
|
|
49
|
-
return schema.checkChild(parent, 'pageBreak');
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Returns a node that will be used to insert a page break with `model.insertContent` to check if the page break can be placed there.
|
|
53
|
-
*/
|
|
54
|
-
function getInsertPageBreakParent(selection, model) {
|
|
55
|
-
const insertionRange = findOptimalInsertionRange(selection, model);
|
|
56
|
-
const parent = insertionRange.start.parent;
|
|
57
|
-
if (parent.isEmpty && !parent.is('element', '$root')) {
|
|
58
|
-
return parent.parent;
|
|
59
|
-
}
|
|
60
|
-
return parent;
|
|
61
|
-
}
|
package/src/pagebreakediting.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module page-break/pagebreakediting
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { toWidget } from 'ckeditor5/src/widget.js';
|
|
10
|
-
import { PageBreakCommand } from './pagebreakcommand.js';
|
|
11
|
-
import '../theme/pagebreak.css';
|
|
12
|
-
/**
|
|
13
|
-
* The page break editing feature.
|
|
14
|
-
*/
|
|
15
|
-
export class PageBreakEditing extends Plugin {
|
|
16
|
-
/**
|
|
17
|
-
* @inheritDoc
|
|
18
|
-
*/
|
|
19
|
-
static get pluginName() {
|
|
20
|
-
return 'PageBreakEditing';
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @inheritDoc
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
static get licenseFeatureCode() {
|
|
27
|
-
return 'PB';
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @inheritDoc
|
|
31
|
-
*/
|
|
32
|
-
static get isOfficialPlugin() {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* @inheritDoc
|
|
37
|
-
*/
|
|
38
|
-
static get isPremiumPlugin() {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* @inheritDoc
|
|
43
|
-
*/
|
|
44
|
-
init() {
|
|
45
|
-
const editor = this.editor;
|
|
46
|
-
const schema = editor.model.schema;
|
|
47
|
-
const t = editor.t;
|
|
48
|
-
const conversion = editor.conversion;
|
|
49
|
-
schema.register('pageBreak', {
|
|
50
|
-
inheritAllFrom: '$blockObject'
|
|
51
|
-
});
|
|
52
|
-
conversion.for('dataDowncast').elementToStructure({
|
|
53
|
-
model: 'pageBreak',
|
|
54
|
-
view: (modelElement, { writer }) => {
|
|
55
|
-
const divElement = writer.createContainerElement('div', {
|
|
56
|
-
class: 'page-break',
|
|
57
|
-
// If user has no `.ck-content` styles, it should always break a page during print.
|
|
58
|
-
style: 'page-break-after: always'
|
|
59
|
-
},
|
|
60
|
-
// For a rationale of using span inside a div see:
|
|
61
|
-
// https://github.com/ckeditor/ckeditor5-page-break/pull/1#discussion_r328934062.
|
|
62
|
-
writer.createContainerElement('span', {
|
|
63
|
-
style: 'display: none'
|
|
64
|
-
}));
|
|
65
|
-
return divElement;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
conversion.for('editingDowncast').elementToStructure({
|
|
69
|
-
model: 'pageBreak',
|
|
70
|
-
view: (modelElement, { writer }) => {
|
|
71
|
-
const label = t('Page break');
|
|
72
|
-
const viewWrapper = writer.createContainerElement('div');
|
|
73
|
-
const viewLabelElement = writer.createRawElement('span', { class: 'page-break__label' }, function (domElement) {
|
|
74
|
-
domElement.innerText = t('Page break');
|
|
75
|
-
});
|
|
76
|
-
writer.addClass('page-break', viewWrapper);
|
|
77
|
-
writer.insert(writer.createPositionAt(viewWrapper, 0), viewLabelElement);
|
|
78
|
-
return toPageBreakWidget(viewWrapper, writer, label);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
conversion.for('upcast')
|
|
82
|
-
.elementToElement({
|
|
83
|
-
view: element => {
|
|
84
|
-
// For upcast conversion it's enough if we check for element style and verify if it's empty
|
|
85
|
-
// or contains only hidden span element.
|
|
86
|
-
const hasPageBreakBefore = element.getStyle('page-break-before') == 'always';
|
|
87
|
-
const hasPageBreakAfter = element.getStyle('page-break-after') == 'always';
|
|
88
|
-
if (!hasPageBreakBefore && !hasPageBreakAfter) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
// The "page break" div accepts only single child or no child at all.
|
|
92
|
-
if (element.childCount == 1) {
|
|
93
|
-
const viewSpan = element.getChild(0);
|
|
94
|
-
// The child must be the "span" element that is not displayed.
|
|
95
|
-
if (!viewSpan.is('element', 'span') || viewSpan.getStyle('display') != 'none') {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else if (element.childCount > 1) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
name: true,
|
|
104
|
-
styles: [
|
|
105
|
-
...(hasPageBreakBefore ? ['page-break-before'] : []),
|
|
106
|
-
...(hasPageBreakAfter ? ['page-break-after'] : [])
|
|
107
|
-
],
|
|
108
|
-
...element.hasClass('page-break') && {
|
|
109
|
-
classes: ['page-break']
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
},
|
|
113
|
-
model: 'pageBreak',
|
|
114
|
-
// This conversion must be checked before <br> conversion because some editors use
|
|
115
|
-
// <br style="page-break-before:always"> as a page break marker.
|
|
116
|
-
converterPriority: 'high'
|
|
117
|
-
});
|
|
118
|
-
editor.commands.add('pageBreak', new PageBreakCommand(editor));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Converts a given {@link module:engine/view/element~ViewElement} to a page break widget:
|
|
123
|
-
* * Adds a {@link module:engine/view/element~ViewElement#_setCustomProperty custom property} allowing to
|
|
124
|
-
* recognize the page break widget element.
|
|
125
|
-
* * Calls the {@link module:widget/utils~toWidget} function with the proper element's label creator.
|
|
126
|
-
*/
|
|
127
|
-
function toPageBreakWidget(viewElement, writer, label) {
|
|
128
|
-
writer.setCustomProperty('pageBreak', true, viewElement);
|
|
129
|
-
return toWidget(viewElement, writer, { label });
|
|
130
|
-
}
|
package/src/pagebreakui.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module page-break/pagebreakui
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { IconPageBreak } from 'ckeditor5/src/icons.js';
|
|
10
|
-
import { ButtonView, MenuBarMenuListItemButtonView } from 'ckeditor5/src/ui.js';
|
|
11
|
-
/**
|
|
12
|
-
* The page break UI plugin.
|
|
13
|
-
*/
|
|
14
|
-
export class PageBreakUI extends Plugin {
|
|
15
|
-
/**
|
|
16
|
-
* @inheritDoc
|
|
17
|
-
*/
|
|
18
|
-
static get pluginName() {
|
|
19
|
-
return 'PageBreakUI';
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
static get isOfficialPlugin() {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/
|
|
30
|
-
init() {
|
|
31
|
-
const editor = this.editor;
|
|
32
|
-
// Add pageBreak button to feature components.
|
|
33
|
-
editor.ui.componentFactory.add('pageBreak', () => {
|
|
34
|
-
const view = this._createButton(ButtonView);
|
|
35
|
-
view.set({
|
|
36
|
-
tooltip: true
|
|
37
|
-
});
|
|
38
|
-
return view;
|
|
39
|
-
});
|
|
40
|
-
editor.ui.componentFactory.add('menuBar:pageBreak', () => this._createButton(MenuBarMenuListItemButtonView));
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Creates a button for page break command to use either in toolbar or in menu bar.
|
|
44
|
-
*/
|
|
45
|
-
_createButton(ButtonClass) {
|
|
46
|
-
const editor = this.editor;
|
|
47
|
-
const locale = editor.locale;
|
|
48
|
-
const command = editor.commands.get('pageBreak');
|
|
49
|
-
const view = new ButtonClass(editor.locale);
|
|
50
|
-
const t = locale.t;
|
|
51
|
-
view.set({
|
|
52
|
-
label: t('Page break'),
|
|
53
|
-
icon: IconPageBreak
|
|
54
|
-
});
|
|
55
|
-
view.bind('isEnabled').to(command, 'isEnabled');
|
|
56
|
-
// Execute the command.
|
|
57
|
-
this.listenTo(view, 'execute', () => {
|
|
58
|
-
editor.execute('pageBreak');
|
|
59
|
-
editor.editing.view.focus();
|
|
60
|
-
});
|
|
61
|
-
return view;
|
|
62
|
-
}
|
|
63
|
-
}
|
package/theme/pagebreak.css
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
.ck-content .page-break {
|
|
7
|
-
position: relative;
|
|
8
|
-
clear: both;
|
|
9
|
-
padding: 5px 0;
|
|
10
|
-
display: flex;
|
|
11
|
-
align-items: center;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
|
|
14
|
-
&::after {
|
|
15
|
-
content: '';
|
|
16
|
-
position: absolute;
|
|
17
|
-
border-bottom: 2px dashed hsl(0, 0%, 77%);
|
|
18
|
-
width: 100%;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.ck-content .page-break__label {
|
|
23
|
-
position: relative;
|
|
24
|
-
z-index: 1;
|
|
25
|
-
padding: .3em .6em;
|
|
26
|
-
display: block;
|
|
27
|
-
text-transform: uppercase;
|
|
28
|
-
border: 1px solid hsl(0, 0%, 77%);
|
|
29
|
-
border-radius: 2px;
|
|
30
|
-
font-size: 0.75em;
|
|
31
|
-
font-weight: bold;
|
|
32
|
-
color: hsl(0, 0%, 20%);
|
|
33
|
-
background: hsl(0, 0%, 100%);
|
|
34
|
-
box-shadow: 2px 2px 1px hsla(0, 0%, 0%, 0.15);
|
|
35
|
-
|
|
36
|
-
/* Disable the possibility to select the label text by the user. */
|
|
37
|
-
-webkit-user-select: none;
|
|
38
|
-
-moz-user-select: none;
|
|
39
|
-
-ms-user-select: none;
|
|
40
|
-
user-select: none;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/* Do not show the page break element inside the print preview window. */
|
|
44
|
-
@media print {
|
|
45
|
-
.ck-content .page-break {
|
|
46
|
-
padding: 0;
|
|
47
|
-
|
|
48
|
-
&::after {
|
|
49
|
-
display: none;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/*
|
|
54
|
-
* From time to time placing page-break directly after a block element with margin causes appending a new blank page in pagination mode.
|
|
55
|
-
* Removing margin-bottom from the block element fixes that issue and the margin is not being moved to the next blank page.
|
|
56
|
-
*
|
|
57
|
-
* Keep this in sync with the pagination plugins.
|
|
58
|
-
*/
|
|
59
|
-
.ck-content *:has(+ .page-break) {
|
|
60
|
-
margin-bottom: 0;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
File without changes
|
/package/{src → dist}/index.d.ts
RENAMED
|
File without changes
|