fix(codeblock): unable to save the selected language
This commit is contained in:
parent
19021ffdd7
commit
ac6a258da8
|
@ -113,7 +113,7 @@ class Engine implements EngineInterface {
|
|||
// 查找父级样式 overflow 或者 overflow-y 为 auto 或者 scroll 的节点
|
||||
const targetValues = ['auto', 'scroll'];
|
||||
let parent = this.container.parent();
|
||||
while (parent && parent.length > 0 && parent.name !== 'body') {
|
||||
while (!sn && parent && parent.length > 0 && parent.name !== 'body') {
|
||||
if (
|
||||
targetValues.includes(parent.css('overflow')) ||
|
||||
targetValues.includes(parent.css('overflow-y'))
|
||||
|
|
|
@ -137,6 +137,12 @@ export interface EditorInterface {
|
|||
* 剪切板
|
||||
*/
|
||||
clipboard: ClipboardInterface;
|
||||
|
||||
/**
|
||||
* 设置滚动节点
|
||||
* @param node 节点
|
||||
*/
|
||||
setScrollNode(node: HTMLElement): void;
|
||||
/**
|
||||
* 绑定事件
|
||||
* @param eventType 事件类型
|
||||
|
@ -532,11 +538,6 @@ export interface EngineInterface extends EditorInterface {
|
|||
* 是否为空内容
|
||||
*/
|
||||
isEmpty(): boolean;
|
||||
/**
|
||||
* 设置滚动节点
|
||||
* @param node 节点
|
||||
*/
|
||||
setScrollNode(node: HTMLElement): void;
|
||||
/**
|
||||
* 获取编辑器值
|
||||
* @param ignoreCursor 是否包含光标位置信息
|
||||
|
|
|
@ -115,7 +115,7 @@ class View implements ViewInterface {
|
|||
// 查找父级样式 overflow 或者 overflow-y 为 auto 或者 scroll 的节点
|
||||
const targetValues = ['auto', 'scroll'];
|
||||
let parent = this.container.parent();
|
||||
while (parent && parent.length > 0 && parent.name !== 'body') {
|
||||
while (!sn && parent && parent.length > 0 && parent.name !== 'body') {
|
||||
if (
|
||||
targetValues.includes(parent.css('overflow')) ||
|
||||
targetValues.includes(parent.css('overflow-y'))
|
||||
|
|
|
@ -155,7 +155,7 @@ class CodeBlockEditor implements CodeBlockEditorInterface {
|
|||
'readOnly',
|
||||
!isEngine(this.editor) || this.editor.readonly ? true : false,
|
||||
);
|
||||
if (code !== undefined) this.save();
|
||||
this.save();
|
||||
}
|
||||
|
||||
render(mode: string, value: string, options?: EditorConfiguration) {
|
||||
|
|
|
@ -174,7 +174,7 @@ class CodeBlcok<V extends CodeBlockValue = CodeBlockValue> extends Card<V> {
|
|||
if (!this.codeEditor.container.inEditor()) {
|
||||
this.codeEditor.container = $(this.codeEditor.renderTemplate());
|
||||
this.mirror = undefined;
|
||||
this.getCenter().append(this.codeEditor.container);
|
||||
this.getCenter().empty().append(this.codeEditor.container);
|
||||
}
|
||||
const value = this.getValue();
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ class CodeBlockEditor implements CodeBlockEditorInterface {
|
|||
'readOnly',
|
||||
!isEngine(this.editor) || this.editor.readonly ? true : false,
|
||||
);
|
||||
if (code !== undefined) this.save();
|
||||
this.save();
|
||||
}
|
||||
|
||||
render(mode: string, value: string, options?: EditorConfiguration) {
|
||||
|
|
|
@ -171,7 +171,7 @@ class CodeBlcok<V extends CodeBlockValue = CodeBlockValue> extends Card<V> {
|
|||
if (!this.codeEditor.container.inEditor()) {
|
||||
this.codeEditor.container = $(this.codeEditor.renderTemplate());
|
||||
this.mirror = undefined;
|
||||
this.getCenter().append(this.codeEditor.container);
|
||||
this.getCenter().empty().append(this.codeEditor.container);
|
||||
}
|
||||
const value = this.getValue();
|
||||
|
||||
|
|
Loading…
Reference in New Issue