GithubHelp home page GithubHelp logo

lpreterite / vue-tinymce Goto Github PK

View Code? Open in Web Editor NEW
180.0 8.0 31.0 2.75 MB

提供给 vue 开发者使用的 TinyMCE 组件

Home Page: http://lpreterite.github.io/vue-tinymce/

License: MIT License

JavaScript 12.59% Vue 5.72% Shell 0.02% HTML 0.34% CSS 81.34%
tinymce vue-component editor vue

vue-tinymce's Introduction

vue-tinymce

vue-tinymce

npm version vue tinymce NPM downloads

提供给 vue 开发者使用的 TinyMCE 组件

目的

为开发人员简单使用 TinyMCE 的 Vue 组件。提供非常简单易懂的源代码提供给开发人员作为参考,当然你也可以直接使用这个组件到你的项目。发现问题可以提到 issue,期望你的反馈 👏。

如何使用

安装组件

yarn add @packy-tang/vue-tinymce
# or
npm install @packy-tang/vue-tinymce

引入

<template>
    <!-- 全局引入TinyMCE -->
    <script src="//unpkg.com/[email protected]/tinymce.min.js"></script>
    <!-- App -->
    <div id="app">
        <vue-tinymce
            v-model="content"
            :setup="setup"
            :setting="setting" />
    </div>
</template>
<script>
    import Vue from "vue"
    import VueTinymce from "@packy-tang/vue-tinymce"

    //安装组件
    Vue.use(VueTinymce)

    new Vue({
        el: "#app",
        data: function() {
            return {
                content: "<p>html content</p>",
                setting: {
                    height: 500
                }
            }
        },
        methods: {
            setup(editor) {
                console.log(editor)
            }
        }
    })
</script>

其他使用例子

  • vue-cli使用例子:传送门
  • webpack使用例子:传送门(待补上)

属性

名称 描述
:content 类型String,作为文本内容传入编辑器,可以使用v-model实现双向绑定
@change 类型Function,编辑器中Input Change Undo Redo ExecCommand KeyUp NodeChange事件响应后触发的事件返回文本内容
:setting 类型Object,编辑器的设置,setup不建议在这设置
:setup 类型Function, 常用与自定义编辑器处理,组件内部做了些处理,建议在这里添加自定义的代码

更多使用细节

想了解更多内容请移步至使用细节

本地调试

# 运行本地例子
$ npm run serve 
# 构建
$ npm run build
# 发布版本
$ npm run release

构建支持

本仓库由sao-esm作为模板构建。

License

Copyright (c) packy-tang [email protected]

根据MIT协议的开源软件.

vue-tinymce's People

Contributors

dependabot[bot] avatar lpreterite avatar q545244819 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  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  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  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-tinymce's Issues

使用新版 tinymce5.6.2 后复制进来的表格拖拽时无法正常渲染宽度

https://codepen.io/packy1980/pen/BayPrVO

分别把链接中 tinymce 的版本替换为:
https://unpkg.com/[email protected]/tinymce.js
https://unpkg.com/[email protected]/tinymce.js

以下是5.1.5版本【gif看的不是很清楚,但其实宽度会正常根据鼠标位置渲染宽度】
5 1 5

以下是5.6.2版本【gif看的不是很清楚,宽度并不会根据鼠标位置渲染宽度】
5 6 2

把 word 的表格复制进去后【在编辑器创建的表格不会有问题】,会发现在 5.6.2 版本下拖拽列表宽度时无法正确渲染,但是版本 5.1.5 是正常的。但是我去官方 demo 页面测试 5.6.2 版本是没问题的。请问这个有没有什么好的解决方法呢?谢谢。

路由切换或者重载的时候会报错误

发现当切换了路由,或者本地开发热重载之后
会报:

beforeMount hook: "TypeError: Cannot read property 'scroll' of undefined"
TypeError: Cannot read property 'scroll' of undefined

editor does not update value on bold/italic

the editor does not update the bound variable when only formatting is changed.

to fix just add "ExecCommand" to the list of events you listen to:

editor.on('input change undo redo ExecCommand' ...

不支持格式刷

高级功能的格式刷,这个根据官网参数配置进去无效,是因为组件版本的问题,还是需要install啥之类的?

v-model can't get correct value.

I just run your example. sometimes I input any character, but <code></code> element doesn't update.
So there is some bug in your watch. After removing it, <code></code> element can update.

插件加载不成功

我的 setting 是这样的,使用了 vue 模板组件:
setting: Object.assign(TinymceSetting, { height: 200, block_formats: "Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;", plugins: 'image table link paste contextmenu textpattern autolink', }),
但是插件并没有加载。

spa项目中多个界面加载编辑器,界面切换后刷新后才能输入

我有两个界面A,B,都分别使用了编辑器组件,当系统第一次调用A的时候,编辑器可用,然后切换到B界面,编辑器无法输入。debug发现,tinymce.init()执行后,editor的init监听,只有页面刷新后的第一次才会执行,类似A界面切换B界面这样的操作,editor不再执行init的监听,请问作者这个问题您遇到了吗,如何解决?急等。

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.