Git Product home page Git Product logo

wangeditor-for-vue3's People

Contributors

callqh avatar wangfupeng1988 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

wangeditor-for-vue3's Issues

初始化报异常

编辑器能正常显示,也能正常输入内容,获取到输入内容的值,初始化的时候无法显示初始值。

初始化的时候报如下异常,查看代码 tokenizePlaceholders 是 prism 里面的。

       Uncaught TypeError: Cannot read properties of undefined (reading 'tokenizePlaceholders')

没有ts的声明文件吗

vue3+ts我引入就给我提示没有找到wangeditor的声明文件,官方有提供吗,还是需要自己声明

V5.1.9报错

V5.1.9会报以下错误:
The requested module '/node_modules/.vite/deps/@wangeditor_editor-for-vue.js?v=c9b4b35f' does not provide an export named 'getEditor' (at Editor.vue:24:1)

提供的demo可复现这个问题。
https://github.com/liuqh0609/editor-vue3-demo

这个demo的yarn.lock锁了5.1.8版本,需要手动升级一下才能复现这个问题

vite+vue3 会提示错误

vite2.8 vue3.2
安装了@wangeditor/editor-for-vue@next

编辑器的config里面全是这个。
arguments: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.invokeGetter (:2:14)]
自定义粘贴和自定义弹窗都失效

实现编辑区域高自适应,建议官方采纳

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`
      })
    })
  }
}

改造 Editor.vue

+ // 编辑器自适应高度 - onCreated 前初始化编辑区域高、监听 resize
+ useAutoHeight(box.value)
context.emit('onCreated', editor)

初始化编辑器内容

  • 建议在 onCreated 内进行
const handleCreated = (editor) => {
  editorRef.value = editor // 记录 editor 实例,重要!
  valueHtml.value = '<p>初始化编辑器内容</p>'
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.