@ckeditor/ckeditor5-code-block 0.0.0-nightly-20260124.0 → 0.0.0-nightly-next-20260124.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/{src → dist}/codeblock.d.ts +1 -1
- package/{src → dist}/codeblockcommand.d.ts +1 -1
- package/{src → dist}/codeblockediting.d.ts +2 -2
- package/{src → dist}/codeblockui.d.ts +1 -1
- package/{src → dist}/converters.d.ts +2 -2
- package/{src → dist}/indentcodeblockcommand.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/{src → dist}/outdentcodeblockcommand.d.ts +1 -1
- package/{src → dist}/utils.d.ts +3 -3
- package/package.json +25 -49
- package/build/code-block.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 -9
- package/lang/translations/af.po +0 -40
- package/lang/translations/ar.po +0 -40
- package/lang/translations/ast.po +0 -40
- package/lang/translations/az.po +0 -40
- package/lang/translations/be.po +0 -40
- package/lang/translations/bg.po +0 -40
- package/lang/translations/bn.po +0 -40
- package/lang/translations/bs.po +0 -40
- package/lang/translations/ca.po +0 -40
- package/lang/translations/cs.po +0 -40
- package/lang/translations/da.po +0 -40
- package/lang/translations/de-ch.po +0 -40
- package/lang/translations/de.po +0 -40
- package/lang/translations/el.po +0 -40
- package/lang/translations/en-au.po +0 -40
- package/lang/translations/en-gb.po +0 -40
- package/lang/translations/en.po +0 -40
- package/lang/translations/eo.po +0 -40
- package/lang/translations/es-co.po +0 -40
- package/lang/translations/es.po +0 -40
- package/lang/translations/et.po +0 -40
- package/lang/translations/eu.po +0 -40
- package/lang/translations/fa.po +0 -40
- package/lang/translations/fi.po +0 -40
- package/lang/translations/fr.po +0 -40
- package/lang/translations/gl.po +0 -40
- package/lang/translations/gu.po +0 -40
- package/lang/translations/he.po +0 -40
- package/lang/translations/hi.po +0 -40
- package/lang/translations/hr.po +0 -40
- package/lang/translations/hu.po +0 -40
- package/lang/translations/hy.po +0 -40
- package/lang/translations/id.po +0 -40
- package/lang/translations/it.po +0 -40
- package/lang/translations/ja.po +0 -40
- package/lang/translations/jv.po +0 -40
- package/lang/translations/kk.po +0 -40
- package/lang/translations/km.po +0 -40
- package/lang/translations/kn.po +0 -40
- package/lang/translations/ko.po +0 -40
- package/lang/translations/ku.po +0 -40
- package/lang/translations/lt.po +0 -40
- package/lang/translations/lv.po +0 -40
- package/lang/translations/ms.po +0 -40
- package/lang/translations/nb.po +0 -40
- package/lang/translations/ne.po +0 -40
- package/lang/translations/nl.po +0 -40
- package/lang/translations/no.po +0 -40
- package/lang/translations/oc.po +0 -40
- package/lang/translations/pl.po +0 -40
- package/lang/translations/pt-br.po +0 -40
- package/lang/translations/pt.po +0 -40
- package/lang/translations/ro.po +0 -40
- package/lang/translations/ru.po +0 -40
- package/lang/translations/si.po +0 -40
- package/lang/translations/sk.po +0 -40
- package/lang/translations/sl.po +0 -40
- package/lang/translations/sq.po +0 -40
- package/lang/translations/sr-latn.po +0 -40
- package/lang/translations/sr.po +0 -40
- package/lang/translations/sv.po +0 -40
- package/lang/translations/th.po +0 -40
- package/lang/translations/ti.po +0 -40
- package/lang/translations/tk.po +0 -40
- package/lang/translations/tr.po +0 -40
- package/lang/translations/tt.po +0 -40
- package/lang/translations/ug.po +0 -40
- package/lang/translations/uk.po +0 -40
- package/lang/translations/ur.po +0 -40
- package/lang/translations/uz.po +0 -40
- package/lang/translations/vi.po +0 -40
- package/lang/translations/zh-cn.po +0 -40
- package/lang/translations/zh.po +0 -40
- package/src/augmentation.js +0 -5
- package/src/codeblock.js +0 -39
- package/src/codeblockcommand.js +0 -142
- package/src/codeblockconfig.js +0 -5
- package/src/codeblockediting.js +0 -430
- package/src/codeblockui.js +0 -134
- package/src/converters.js +0 -285
- package/src/indentcodeblockcommand.js +0 -82
- package/src/index.js +0 -16
- package/src/outdentcodeblockcommand.js +0 -137
- package/src/utils.js +0 -296
- package/theme/codeblock.css +0 -40
- /package/{src → dist}/augmentation.d.ts +0 -0
- /package/{src → dist}/codeblockconfig.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
package/src/utils.js
DELETED
|
@@ -1,296 +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
|
-
import { first } from 'ckeditor5/src/utils.js';
|
|
6
|
-
/**
|
|
7
|
-
* Returns code block languages as defined in `config.codeBlock.languages` but processed:
|
|
8
|
-
*
|
|
9
|
-
* * To consider the editor localization, i.e. to display {@link module:code-block/codeblockconfig~CodeBlockLanguageDefinition}
|
|
10
|
-
* in the correct language. There is no way to use {@link module:utils/locale~Locale#t} when the user
|
|
11
|
-
* configuration is defined because the editor does not exist yet.
|
|
12
|
-
* * To make sure each definition has a CSS class associated with it even if not specified
|
|
13
|
-
* in the original configuration.
|
|
14
|
-
*
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export function getNormalizedAndLocalizedLanguageDefinitions(editor) {
|
|
18
|
-
const t = editor.t;
|
|
19
|
-
const languageDefs = editor.config.get('codeBlock.languages');
|
|
20
|
-
for (const def of languageDefs) {
|
|
21
|
-
if (def.label === 'Plain text') {
|
|
22
|
-
def.label = t('Plain text');
|
|
23
|
-
}
|
|
24
|
-
if (def.class === undefined) {
|
|
25
|
-
def.class = `language-${def.language}`;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return languageDefs;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Returns an object associating certain language definition properties with others. For instance:
|
|
32
|
-
*
|
|
33
|
-
* For:
|
|
34
|
-
*
|
|
35
|
-
* ```ts
|
|
36
|
-
* const definitions = {
|
|
37
|
-
* { language: 'php', class: 'language-php', label: 'PHP' },
|
|
38
|
-
* { language: 'javascript', class: 'js', label: 'JavaScript' },
|
|
39
|
-
* };
|
|
40
|
-
*
|
|
41
|
-
* getPropertyAssociation( definitions, 'class', 'language' );
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* returns:
|
|
45
|
-
*
|
|
46
|
-
* ```ts
|
|
47
|
-
* {
|
|
48
|
-
* 'language-php': 'php',
|
|
49
|
-
* 'js': 'javascript'
|
|
50
|
-
* }
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* and
|
|
54
|
-
*
|
|
55
|
-
* ```ts
|
|
56
|
-
* getPropertyAssociation( definitions, 'language', 'label' );
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* returns:
|
|
60
|
-
*
|
|
61
|
-
* ```ts
|
|
62
|
-
* {
|
|
63
|
-
* 'php': 'PHP',
|
|
64
|
-
* 'javascript': 'JavaScript'
|
|
65
|
-
* }
|
|
66
|
-
* ```
|
|
67
|
-
*
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
70
|
-
export function getPropertyAssociation(languageDefs, key, value) {
|
|
71
|
-
const association = {};
|
|
72
|
-
for (const def of languageDefs) {
|
|
73
|
-
if (key === 'class') {
|
|
74
|
-
// Only the first class is considered.
|
|
75
|
-
const newKey = (def[key]).split(' ').shift();
|
|
76
|
-
association[newKey] = def[value];
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
association[def[key]] = def[value];
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return association;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* For a given model text node, it returns white spaces that precede other characters in that node.
|
|
86
|
-
* This corresponds to the indentation part of the code block line.
|
|
87
|
-
*
|
|
88
|
-
* @internal
|
|
89
|
-
*/
|
|
90
|
-
export function getLeadingWhiteSpaces(textNode) {
|
|
91
|
-
return textNode.data.match(/^(\s*)/)[0];
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* For plain text containing the code (a snippet), it returns a document fragment containing
|
|
95
|
-
* view text nodes separated by `<br>` elements (in place of new line characters "\n"), for instance:
|
|
96
|
-
*
|
|
97
|
-
* Input:
|
|
98
|
-
*
|
|
99
|
-
* ```ts
|
|
100
|
-
* "foo()\n
|
|
101
|
-
* bar()"
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* Output:
|
|
105
|
-
*
|
|
106
|
-
* ```html
|
|
107
|
-
* <DocumentFragment>
|
|
108
|
-
* "foo()"
|
|
109
|
-
* <br/>
|
|
110
|
-
* "bar()"
|
|
111
|
-
* </DocumentFragment>
|
|
112
|
-
* ```
|
|
113
|
-
*
|
|
114
|
-
* @param text The raw code text to be converted.
|
|
115
|
-
* @internal
|
|
116
|
-
*/
|
|
117
|
-
export function rawSnippetTextToViewDocumentFragment(writer, text) {
|
|
118
|
-
const fragment = writer.createDocumentFragment();
|
|
119
|
-
const textLines = text.split('\n');
|
|
120
|
-
const items = textLines.reduce((nodes, line, lineIndex) => {
|
|
121
|
-
nodes.push(line);
|
|
122
|
-
if (lineIndex < textLines.length - 1) {
|
|
123
|
-
nodes.push(writer.createElement('br'));
|
|
124
|
-
}
|
|
125
|
-
return nodes;
|
|
126
|
-
}, []);
|
|
127
|
-
writer.appendChild(items, fragment);
|
|
128
|
-
return fragment;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Returns an array of all model positions within the selection that represent code block lines.
|
|
132
|
-
*
|
|
133
|
-
* If the selection is collapsed, it returns the exact selection anchor position:
|
|
134
|
-
*
|
|
135
|
-
* ```html
|
|
136
|
-
* <codeBlock>[]foo</codeBlock> -> <codeBlock>^foo</codeBlock>
|
|
137
|
-
* <codeBlock>foo[]bar</codeBlock> -> <codeBlock>foo^bar</codeBlock>
|
|
138
|
-
* ```
|
|
139
|
-
*
|
|
140
|
-
* Otherwise, it returns positions **before** each text node belonging to all code blocks contained by the selection:
|
|
141
|
-
*
|
|
142
|
-
* ```html
|
|
143
|
-
* <codeBlock> <codeBlock>
|
|
144
|
-
* foo[bar ^foobar
|
|
145
|
-
* <softBreak></softBreak> -> <softBreak></softBreak>
|
|
146
|
-
* baz]qux ^bazqux
|
|
147
|
-
* </codeBlock> </codeBlock>
|
|
148
|
-
* ```
|
|
149
|
-
*
|
|
150
|
-
* It also works across other non–code blocks:
|
|
151
|
-
*
|
|
152
|
-
* ```html
|
|
153
|
-
* <codeBlock> <codeBlock>
|
|
154
|
-
* foo[bar ^foobar
|
|
155
|
-
* </codeBlock> </codeBlock>
|
|
156
|
-
* <paragraph>text</paragraph> -> <paragraph>text</paragraph>
|
|
157
|
-
* <codeBlock> <codeBlock>
|
|
158
|
-
* baz]qux ^bazqux
|
|
159
|
-
* </codeBlock> </codeBlock>
|
|
160
|
-
* ```
|
|
161
|
-
*
|
|
162
|
-
* **Note:** The positions are in reverse order so they do not get outdated when iterating over them and
|
|
163
|
-
* the writer inserts or removes elements at the same time.
|
|
164
|
-
*
|
|
165
|
-
* **Note:** The position is located after the leading white spaces in the text node.
|
|
166
|
-
*
|
|
167
|
-
* @internal
|
|
168
|
-
*/
|
|
169
|
-
export function getIndentOutdentPositions(model) {
|
|
170
|
-
const selection = model.document.selection;
|
|
171
|
-
const positions = [];
|
|
172
|
-
// When the selection is collapsed, there's only one position we can indent or outdent.
|
|
173
|
-
if (selection.isCollapsed) {
|
|
174
|
-
return [selection.anchor];
|
|
175
|
-
}
|
|
176
|
-
// When the selection is NOT collapsed, collect all positions starting before text nodes
|
|
177
|
-
// (code lines) in any <codeBlock> within the selection.
|
|
178
|
-
// Walk backward so positions we are about to collect here do not get outdated when
|
|
179
|
-
// inserting or deleting using the writer.
|
|
180
|
-
const walker = selection.getFirstRange().getWalker({
|
|
181
|
-
ignoreElementEnd: true,
|
|
182
|
-
direction: 'backward'
|
|
183
|
-
});
|
|
184
|
-
for (const { item } of walker) {
|
|
185
|
-
let node = item.is('$textProxy') ? item.textNode : item;
|
|
186
|
-
const parent = node.parent;
|
|
187
|
-
if (!parent.is('element', 'codeBlock') || node.is('element', 'softBreak')) {
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
// For each item in code block, move backwards until the beginning of the line it is in is found.
|
|
191
|
-
while (node.previousSibling && !node.previousSibling.is('element', 'softBreak')) {
|
|
192
|
-
node = node.previousSibling;
|
|
193
|
-
}
|
|
194
|
-
// Take the leading white spaces into account (only for text nodes).
|
|
195
|
-
const startOffset = !node.is('$text') ? node.startOffset : node.startOffset + getLeadingWhiteSpaces(node).length;
|
|
196
|
-
const position = model.createPositionAt(parent, startOffset);
|
|
197
|
-
// Do not add the same position twice. Unfortunately using set doesn't deduplicate positions because
|
|
198
|
-
// they are different objects.
|
|
199
|
-
if (positions.every(pos => !pos.isEqual(position))) {
|
|
200
|
-
positions.push(position);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return positions;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Checks if any of the blocks within the model selection is a code block.
|
|
207
|
-
*
|
|
208
|
-
* @internal
|
|
209
|
-
*/
|
|
210
|
-
export function isModelSelectionInCodeBlock(selection) {
|
|
211
|
-
const firstBlock = first(selection.getSelectedBlocks());
|
|
212
|
-
return !!firstBlock && firstBlock.is('element', 'codeBlock');
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Checks if an {@link module:engine/model/element~ModelElement Element} can become a code block.
|
|
216
|
-
*
|
|
217
|
-
* @param schema Model's schema.
|
|
218
|
-
* @param element The element to be checked.
|
|
219
|
-
* @returns Check result.
|
|
220
|
-
* @internal
|
|
221
|
-
*/
|
|
222
|
-
export function canBeCodeBlock(schema, element) {
|
|
223
|
-
if (element.is('rootElement') || schema.isLimit(element)) {
|
|
224
|
-
return false;
|
|
225
|
-
}
|
|
226
|
-
return schema.checkChild(element.parent, 'codeBlock');
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Get the translated message read by the screen reader when you enter or exit an element with your cursor.
|
|
230
|
-
*
|
|
231
|
-
* @internal
|
|
232
|
-
*/
|
|
233
|
-
export function getCodeBlockAriaAnnouncement(t, languageDefs, element, direction) {
|
|
234
|
-
const languagesToLabels = getPropertyAssociation(languageDefs, 'language', 'label');
|
|
235
|
-
const codeBlockLanguage = element.getAttribute('language');
|
|
236
|
-
if (codeBlockLanguage in languagesToLabels) {
|
|
237
|
-
const language = languagesToLabels[codeBlockLanguage];
|
|
238
|
-
if (direction === 'enter') {
|
|
239
|
-
return t('Entering %0 code snippet', language);
|
|
240
|
-
}
|
|
241
|
-
return t('Leaving %0 code snippet', language);
|
|
242
|
-
}
|
|
243
|
-
if (direction === 'enter') {
|
|
244
|
-
return t('Entering code snippet');
|
|
245
|
-
}
|
|
246
|
-
return t('Leaving code snippet');
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* For given position, finds the closest position that is at the beginning of a line of code and returns a text node that is at the
|
|
250
|
-
* beginning of the line (or `null` if there's no text node at the beginning of a given line).
|
|
251
|
-
*
|
|
252
|
-
* Line beings at the start of a code block element and after each `softBreak` element.
|
|
253
|
-
*
|
|
254
|
-
* Note: even though code block doesn't allow inline elements other than `<softBreak>` by default, some features may overwrite this rule,
|
|
255
|
-
* so such inline elements are taken into account.
|
|
256
|
-
*
|
|
257
|
-
* Some examples of expected results:
|
|
258
|
-
*
|
|
259
|
-
* ```
|
|
260
|
-
* <codeBlock>^</codeBlock> -> null
|
|
261
|
-
* <codeBlock>^foobar</codeBlock> -> <codeBlock>[foobar]</codeBlock>
|
|
262
|
-
* <codeBlock>foobar^</codeBlock> -> <codeBlock>[foobar]</codeBlock>
|
|
263
|
-
* <codeBlock>foo^bar</codeBlock> -> <codeBlock>[foobar]</codeBlock>
|
|
264
|
-
* <codeBlock>foo^<softBreak />bar</codeBlock> -> <codeBlock>[foo]<softBreak />bar</codeBlock>
|
|
265
|
-
* <codeBlock>foo<softBreak />bar^</codeBlock> -> <codeBlock>foo<softBreak />[bar]</codeBlock>
|
|
266
|
-
* <codeBlock>foo<softBreak />b^ar</codeBlock> -> <codeBlock>foo<softBreak />[bar]</codeBlock>
|
|
267
|
-
* <codeBlock>foo<softBreak />^bar</codeBlock> -> <codeBlock>foo<softBreak />[bar]</codeBlock>
|
|
268
|
-
* <codeBlock>^<element /></codeBlock> -> null
|
|
269
|
-
* <codeBlock><element />^</codeBlock> -> null
|
|
270
|
-
* <codeBlock>foo^<element /></codeBlock> -> <codeBlock>[foo]<element /></codeBlock>
|
|
271
|
-
* <codeBlock>foo<element />^</codeBlock> -> <codeBlock>[foo]<element /></codeBlock>
|
|
272
|
-
* <codeBlock>foo<element />bar^</codeBlock> -> <codeBlock>[foo]<element />bar</codeBlock>
|
|
273
|
-
* <codeBlock><element />bar^</codeBlock> -> null
|
|
274
|
-
* <codeBlock>foo<softBreak />^<softBreak /></codeBlock> -> null
|
|
275
|
-
* <codeBlock>foo<softBreak />^<element /></codeBlock> -> null
|
|
276
|
-
* <codeBlock>foo<softBreak /><element />^</codeBlock> -> null
|
|
277
|
-
* <codeBlock>foo<softBreak />bar<element />^</codeBlock> -> <codeBlock>foo<softBreak />[bar]<element /></codeBlock>
|
|
278
|
-
* <codeBlock>foo<softBreak /><element />ba^r</codeBlock> -> null
|
|
279
|
-
* ```
|
|
280
|
-
*
|
|
281
|
-
* @internal
|
|
282
|
-
*/
|
|
283
|
-
export function getTextNodeAtLineStart(position, model) {
|
|
284
|
-
// First, move position before a text node, if it is inside a text node.
|
|
285
|
-
if (position.textNode) {
|
|
286
|
-
position = model.createPositionBefore(position.textNode);
|
|
287
|
-
}
|
|
288
|
-
// Then, jump-back the position until it is before a `softBreak` or at the beginning of the `codeBlock`.
|
|
289
|
-
while (position.nodeBefore && !position.nodeBefore.is('element', 'softBreak')) {
|
|
290
|
-
position = model.createPositionBefore(position.nodeBefore);
|
|
291
|
-
}
|
|
292
|
-
// Now, the position is at the beginning of a line.
|
|
293
|
-
// Return a text node after the position, if there is one.
|
|
294
|
-
const nodeAtStart = position.nodeAfter;
|
|
295
|
-
return nodeAtStart && nodeAtStart.is('$text') ? nodeAtStart : null;
|
|
296
|
-
}
|
package/theme/codeblock.css
DELETED
|
@@ -1,40 +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 pre {
|
|
7
|
-
padding: 1em;
|
|
8
|
-
color: hsl(0, 0%, 20.8%);
|
|
9
|
-
background: hsla(0, 0%, 78%, 0.3);
|
|
10
|
-
border: 1px solid hsl(0, 0%, 77%);
|
|
11
|
-
border-radius: 2px;
|
|
12
|
-
|
|
13
|
-
/* Code block are language direction–agnostic. */
|
|
14
|
-
text-align: left;
|
|
15
|
-
direction: ltr;
|
|
16
|
-
|
|
17
|
-
tab-size: 4;
|
|
18
|
-
white-space: pre-wrap;
|
|
19
|
-
|
|
20
|
-
/* Don't inherit the style, e.g. when in a block quote. */
|
|
21
|
-
font-style: normal;
|
|
22
|
-
|
|
23
|
-
/* Don't let the code be squashed e.g. when in a table cell. */
|
|
24
|
-
min-width: 200px;
|
|
25
|
-
|
|
26
|
-
& code {
|
|
27
|
-
background: unset;
|
|
28
|
-
padding: 0;
|
|
29
|
-
border-radius: 0;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.ck.ck-editor__editable pre {
|
|
34
|
-
position: relative;
|
|
35
|
-
|
|
36
|
-
&[data-language]::after {
|
|
37
|
-
content: attr(data-language);
|
|
38
|
-
position: absolute;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
File without changes
|
|
File without changes
|
/package/{src → dist}/index.d.ts
RENAMED
|
File without changes
|