We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import {useWindowSize, useElementBounding, toValue} from '@vueuse/core' /** * 编辑器自适应高度 * * @export * @param {HTMLElement} selector */ export function useAutoHeight(selector: HTMLElement) { if (selector) { setTimeout(() => { const { height: windowHeight } = useWindowSize() // scroll 元素 w-e-text-container const scrollElement = selector.firstChild as HTMLElement // 记录 windowHeight const lastWindowHeight = ref(toValue(windowHeight)) // 初始化 scroll 元素 height const { height: scrollHeight } = useElementBounding(scrollElement) scrollElement.style.height = `${toValue(scrollHeight)}px` // 监听 windowHeight watch(windowHeight, (height) => { const changeHeight = toValue(height) - toValue(lastWindowHeight) lastWindowHeight.value = toValue(height) scrollElement.style.height = `${toValue(scrollHeight) + changeHeight}px` }) }) } }
+ // 编辑器自适应高度 - onCreated 前初始化编辑区域高、监听 resize + useAutoHeight(box.value) context.emit('onCreated', editor)
const handleCreated = (editor) => { editorRef.value = editor // 记录 editor 实例,重要! valueHtml.value = '<p>初始化编辑器内容</p>' }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
改造 Editor.vue
初始化编辑器内容
The text was updated successfully, but these errors were encountered: