* [misc] support for setting editor size to "auto".

This commit is contained in:
sunhao
2024-08-14 09:19:11 +08:00
committed by 刘刚
parent 82ee2df768
commit 5d9c343a7d
2 changed files with 4 additions and 3 deletions
+1
View File
@@ -7,6 +7,7 @@ textarea[size="full"] {min-height: 100%; height: 100%;}
[data-tippy-root] tiptap-menu-item > button {font-size: inherit; font-family: Arial; line-height: normal;}
.editor-container {width: 100%; box-shadow: inset 0 0 0 1px var(--form-control-border); border-radius: var(--form-control-radius);}
.editor-container.is-readonly {box-shadow: none;}
.editor-container zen-editor {display: none;}
.editor-container textarea {height: initial;}
[data-loaded-editor] .editor-container zen-editor {display: block;}
+3 -3
View File
@@ -14,7 +14,7 @@ class editor extends wg
'fullscreenable?: bool=true', // 是否可全屏
'resizable?: bool=true', // 是否可拖拽调整大小
'exposeEditor?: bool=true', // 是否将编辑器实例挂载到 `window.$zenEditors`
'size?: string="sm"', // 尺寸,可选值 'sm', 'lg', 'full'
'size?: string="sm"', // 尺寸,可选值 'sm', 'lg', 'full', 'auto'
'hideMenubar?: bool=false', // 是否隐藏菜单栏
'hideUI?: bool=false', // 是否隐藏整个编辑器 UI
'readonly?: bool=false', // 是否只读
@@ -97,7 +97,7 @@ class editor extends wg
$editor = new h
(
setTag('zen-editor'),
setClass('form-control', 'p-0'),
setClass('p-0', $this->prop('readonly') ? '' : 'form-control'),
$this->prop('size') === 'full' ? setStyle('height', '100%') : setClass('h-auto')
);
@@ -119,7 +119,7 @@ class editor extends wg
return div
(
setClass('editor-container p-px mt-px rounded relative'),
setClass('editor-container p-px mt-px rounded relative', $this->prop('readonly') ? 'is-readonly' : ''),
$props['size'] === 'full' ? setStyle('height', '100%') : setClass('h-auto'),
h::css(self::$css), // Inject CSS on page, for tippy menus.
$templateType ? $this->buildTemplate($this->prop('name'), $templateType) : null,