/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ /** * @module code-block/converters */ import type { GetCallback } from "@ckeditor/ckeditor5-utils"; import type { DowncastInsertEvent, Model, UpcastElementEvent, UpcastTextEvent, EditingView } from "@ckeditor/ckeditor5-engine"; import type { CodeBlockLanguageDefinition } from "./codeblockconfig.js"; /** * A model-to-view (both editing and data) converter for the `codeBlock` element. * * Sample input: * * ```html * foo();bar(); * ``` * * Sample output (editing): * * ```html *
foo();
bar();
* ``` * * Sample output (data, see {@link module:code-block/converters~modelToDataViewSoftBreakInsertion}): * * ```html *
foo();\nbar();
* ``` * * @param languageDefs The normalized language configuration passed to the feature. * @param useLabels When `true`, the `
` element will get a `data-language` attribute with a
* human–readable label of the language. Used only in the editing.
* @returns Returns a conversion callback.
* @internal
*/
export declare function modelToViewCodeBlockInsertion(model: Model, languageDefs: Array, useLabels?: boolean): GetCallback;
/**
* A model-to-data view converter for the new line (`softBreak`) separator.
*
* Sample input:
*
* ```html
* foo();bar();
* ```
*
* Sample output:
*
* ```html
* 
foo();\nbar();
* ``` * * @returns Returns a conversion callback. * @internal */ export declare function modelToDataViewSoftBreakInsertion(model: Model): GetCallback; /** * A view-to-model converter for `
` with the `` HTML.
*
* Sample input:
*
* ```html
* 
foo();bar();
* ``` * * Sample output: * * ```html * foo();bar(); * ``` * * @param languageDefs The normalized language configuration passed to the feature. * @returns Returns a conversion callback. * @internal */ export declare function dataViewToModelCodeBlockInsertion(editingView: EditingView, languageDefs: Array): GetCallback; /** * A view-to-model converter for new line characters in `
`.
*
* Sample input:
*
* ```html
* 
foo();\nbar();
* ``` * * Sample output: * * ```html * foo();bar(); * ``` * * @returns {Function} Returns a conversion callback. * @internal */ export declare function dataViewToModelTextNewlinesInsertion(): GetCallback; /** * A view-to-model converter that handles orphan text nodes (white spaces, new lines, etc.) * that surround `` inside `
`.
*
* Sample input:
*
* ```html
* // White spaces
* 
 foo() 
* * // White spaces *
      foo()      
* * // White spaces *
			foo()			
* * // New lines *
* 	foo()
* 
* * // Redundant text *
ABCfoo()DEF
* ``` * * Unified output for each case: * * ```html * foo() * ``` * * @returns Returns a conversion callback. * @internal */ export declare function dataViewToModelOrphanNodeConsumer(): GetCallback;