CodeBlockManager

CodeBlockManager

Constructor

new CodeBlockManager()

Methods

static getSharedInstance() → {CodeBlockManager}

Get shared instance to CodeBlockManager.

Returns:
CodeBlockManager

createCodeBlockHtml(type, codeText) → {string}

Create code block html.

Parameters:
Name Type Description
type string

code block type or language type

codeText string

code text

Returns:
string

replaceElements($container, isViewOnly, isWysiwygMode)

Replace code block elements.

Parameters:
Name Type Description
$container jQuery

jQuery element container by view mode like viewOnly, wysiwyg, preview

isViewOnly boolean

whether view only or not

isWysiwygMode boolean

whether wysiwyg mode or not

setElementReplacer(type, replacer)

Set replacer for code block element.

Parameters:
Name Type Description
type string

code block type

replacer Object

replacer to code block element

updateCodeTextById(containerElement, id, codeText)

Update code text by code block id and container element.

Parameters:
Name Type Description
containerElement HTMLElement

container element by view mode like viewOnly, wysiwyg, preview.

id string

code block id

codeText string

code text for updating