GithubHelp home page GithubHelp logo

dangvanthanh / vue-ckeditor2 Goto Github PK

View Code? Open in Web Editor NEW
171.0 10.0 64.0 3.22 MB

CKEditor 4 wrapper by Vue.js

Home Page: https://vue-ckeditor2.surge.sh/

License: MIT License

JavaScript 6.81% Vue 91.83% Shell 1.36%
vue vue-ckeditor ckeditor

vue-ckeditor2's Introduction

vue-ckeditor

Ckeditor using for Vue.js 2

Requirements

Install

CDN

<script src="https://unpkg.com/vue-ckeditor2"></script>

NPM

$ npm install vue-ckeditor2 --save

Usage

This document applies to v2.0+. If you are looking for older versions, docs are here

Component

Then in your component:

<template>
  <div>
    <vue-ckeditor 
      v-model="content" 
      :config="config" 
      @blur="onBlur($event)" 
      @focus="onFocus($event)"
      @contentDom="onContentDom($event)"
      @dialogDefinition="onDialogDefinition($event)"
      @fileUploadRequest="onFileUploadRequest($event)"
      @fileUploadResponse="onFileUploadResponse($event)" />
  </div>
</template>

<script>
import VueCkeditor from 'vue-ckeditor2';

export default {
  components: { VueCkeditor },
  data() {
    return {
      content: '',
      config: {
        toolbar: [
          ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript']
        ],
        height: 300
      }
    };
  },
  methods: {
    onBlur(evt) {
      console.log(evt);
    },
    onFocus(evt) {
      console.log(evt);
    },
    onContentDom(evt) {
      console.log(evt);
    },
    onDialogDefinition(evt) {
      console.log(evt);
    },
    onFileUploadRequest(evt) {
      console.log(evt);
    },
    onFileUploadResponse(evt) {
      console.log(evt);
    }
  }
};
</script>

Props

Name Type Description
name String Name of instance ckedior. **Default: editor- **
id String Id of instance ckedior. Default: editor-1
types String Types of ckedior. Default: classic
config Object All configuration of ckeditor. Default: {}
instanceReadyCallback Function Optional function that will be attached to CKEditor instanceReady event.
readOnlyMode Boolean Option setReadOnly editor initializes in the proper mode. Default: false

Events

Name Description
blur Fired when the editor instance loses the input focus.
focus Fired when the editor instance receives the input focus.
contentDom Event fired when the editor content (its DOM structure) is ready
dialogDefinition Event fired when a dialog definition is about to be used to create a dialog into an editor instance
fileUploadRequest Event fired when the file loader should send XHR
fileUploadResponse Event fired when the file loader response is received and needs to be parsed

Build Setup

You can use vue-cli with vue-rollup-boilerplate templates or other vue templates

Created By

Thanks to contributers

License

MIT © Dang Van Thanh

vue-ckeditor2's People

Contributors

chengpan168 avatar christoph-wagner avatar comfuture avatar dangvanthanh avatar fernandomm avatar ganlvtech avatar leshgan avatar msarris avatar patrickdavey avatar rlfscin 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  avatar  avatar

vue-ckeditor2's Issues

value exists, v-model added but ckeditor area is empty

screenshot 2017-08-23 21 27 07

What might be wrong?

The code:

export default {
  components: { Ckeditor },
  data () {
    return {
      id: null,
      name: null,
      body: null,
      order: null,
      config: {
        toolbar: [
          { name: 'clipboard', items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
          { name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
          { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
          { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', '-', 'RemoveFormat'] },
          { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote'] },
          { name: 'styles', items: ['Styles', 'Format'] }
        ],
        height: 500
      }
    }
  },
  methods: {
    editLesson () {
      this.axios({
        method: 'patch',
        url: 'some-url',
        data: {
          'id': this.id,
          'name': this.name,
          'body': this.body,
          'order': this.order,
          'is_active': true
        },
        headers: {
          'Authorization': 'Token ' + this.$cookie.get('token'),
          'Content-Type': 'application/json'
        }
      }).then((data) => {
        this.$router.push({name: 'Dashboard Lessons'})
      })
    },
    updateLesson () {
      this.axios({
        method: 'get',
        url: 'some-url',
        headers: {
          'Authorization': 'Token ' + this.$cookie.get('token'),
          'Content-Type': 'application/json'
        }
      }).then((response) => {
        this.body = response.data.body
        this.name = response.data.name
        this.order = response.data.order
        this.id = response.data.id
        var at = this
        console.log(at)
      }).catch((error) => {
        console.log(error.response)
      })
    }
  },
  beforeMount () {
    this.updateLesson()
  }
}

Using custom CKeditor instance in webpack boilerplate

How can I use a custom CKeditor build?
Using the vue-cli webpack boilerplate.
In .vue component I add

import CKEDITOR from 'ckeditor'
import Ckeditor from 'vue-ckeditor2'

Removed the CDN for CKeditor from index.html:

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>Squarell DAP App</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
</head>

<body>
  <div id="app"></div>
  <!-- <script src="//cdn.ckeditor.com/4.6.2/full/ckeditor.js"></script> -->
  <!-- built files will be auto injected -->
</body>

</html>

Now I get errors like

ckeditor.js?7294:232 Uncaught TypeError: Cannot set property 'dir' of undefined
at Object.f (eval at (app.js:1206), :232:470)
at g (eval at (app.js:1206), :234:33)
at Array.n (eval at (app.js:1206), :234:188)
at p (eval at (app.js:1206), :234:272)
at HTMLScriptElement.CKEDITOR.env.ie.e.$.onerror (eval at (app.js:1206), :235:209)

Unexpected token

Hello. I use Vue 2 (Vuex) and Laravel Elixir with Browserify to compile my files.
It gives me an error message:

<template> ^ ParseError: Unexpected token

Other components in project work fine. All dependencies are up-to-date.
What am I doing wrong?

vue-ckeditor Vue 1.x

Could anyone please tell me how to use this?

Can't seem to figure out how to get it working. I've got it in my package.json like this:
"vue-ckeditor": "[email protected]:dangvanthanh/vue-ckeditor2.git#1.0"
and it's being loaded successfully. But how to go on?

Thanks in advance.

Vue packages version mismatch

I'm using laravel mix and added vue-ckeditor2 to my packages. When I run npm run dev to compile and webpack my files it works well untill I add this line :

import Ckeditor from 'vue-ckeditor2';

With only this import I start getting this error :

ERROR  Failed to compile with 1 errors                                                                                                           10:18:59 AM

 error  in ./~/vue-ckeditor2/src/ckeditor.vue

Module build failed: Error:

Vue packages version mismatch:

- [email protected]
- [email protected]

This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.

    at Object.<anonymous> (/home/runcloud/webapps/vixen/releases/1493216904/node_modules/vue-template-compiler/index.js:8:9)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/runcloud/webapps/vixen/releases/1493216904/node_modules/vue-loader/lib/parser.js:1:78)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/runcloud/webapps/vixen/releases/1493216904/node_modules/vue-loader/lib/loader.js:3:13)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/runcloud/webapps/vixen/releases/1493216904/node_modules/vue-loader/index.js:1:80)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

 @ ./resources/assets/js/app.js 26:0-37
 @ multi ./resources/assets/js/app.js

My versions are as follow :

[email protected]
[email protected]
[email protected] (I also tried with [email protected])
[email protected]
[email protected]
[email protected]

Also, here is my package.json file :

{
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },
  "dependencies": {
    "axios": "^0.15.2",
    "bootstrap": "^3.0.0",
    "ckeditor": "^4.6.2",
    "cross-env": "^3.2.3",
    "jquery": "^2.1.4",
    "js-cookie": "^2.1.0",
    "laravel-mix": "0.*",
    "moment": "^2.10.6",
    "promise": "^7.1.1",
    "sweetalert": "^1.1.3",
    "underscore": "^1.8.3",
    "urijs": "^1.17.0",
    "v-mask": "~1.1.1",
    "vue": "~2.0.8",
    "vue-ckeditor2": "~1.0.5",
    "webpack": "^2.3.2"
  }
}

Error in destroying instance

VERSION:

"vue": "^2.4.2"
"vue-ckeditor2": "^1.16.0"
"webpack": "^3.7.1"

ERROR

Uncaught TypeError: Cannot read property 'getRanges' of null

SOLICITATION

replacement of the function that destroys the instance.

DETAILS

I would like to congratulate you on your good work.

I encountered a problem of vue-ckeditor2 the moment he tries to destroy the instance.
You are destroying the instance in vue-ckeditor2/src/VCkeditor.vue:

destroy () {
   if (!this.destroyed) {
        this.instance.focusManager.blur(true)
        this.instance.removeAllListeners()
        this.instance.destroy()
        this.destroyed = true
   }
}

for some reason the instance was not being properly destroyed. I searched the repository of ckeditor and they ask to use the following statement:

destroy () {
   CKEDITOR.instances[this.id].destroy()
}

I tested it here and it worked correctly with the statement CKEDITOR.instances[this.id].destroy().
Could you review a library update? I do not want to need to change the core of the library manually.

thank you

multiple ckeditor

hello i am not able to integrate two ckeditor in a single page in SPA

Reload config?

Hello,

I want to dynamically set the readOnly property in the config, and right now, if I change the config the edito will not change.
Is there a way to make the editor reactie to the config changes?

OnChange event not firing when using ck-editor in source mode

Hello @dangvanthanh - Thanks for creating this!!

I added a console.log in ckeditor.vue here:

this.instance.on('change', () => {
        console.log('ckeditor onchange');
        let html = this.instance.getData()
        if (html !== this.value) {
          this.$emit('changed', this.instance)
        }
      })

I see my log message whenever I make a change in ck-editor's 'normal' mode, but I don't see when in 'source' mode.

Update: looks like ck-editor itself doesn't fire change events in source mode:

Sounds like there are some valid reasons for that behavior, but it leaves me unable to detect the changed content if a user makes a change in ck-editor source mode. Anyone know of a workaround for this?

Thanks for any help!!

IE 11 problem

In IE 11, CKEditor doesn't get content if it's exist. It shows only the empty editor. It shows permision error in console log.

cross-env NODE_ENV=development rollup -cw

npm ERR! Linux 4.4.0-38-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v4.2.6
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: cross-env NODE_ENV=development rollup -cw
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script 'cross-env NODE_ENV=development rollup -cw'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vue-ckeditor package,
npm ERR! not with npm itself.

Editor version bump?

Any chance this lib gets bumped to version 5 sometime soon after production release arrives?

using vue-ckedtior in template with v-if

Hello,
i've got some strange behaviour. We have a construct like

<keep-alive>
  <my-form-template  v-if="showForm" />
</keep-alive>

where <my-form-template> contains the <ckeditor> template.

However, when <my-form-template> is hidden (showForm := false) and shown again, the ckeditor does not work anymore.

Seems to be more a ckeditor issue (the iframe of the editor is corrupted, or whatever...).

But any ideas how to solve this problem?

As workaround i use a extra "active" property in ckeditor.vue in combination with a watcher

        watch: {
		active (value) {
			if (value) {
				this.create()     // mounted () 
			} else {
				this.destroy()  // beforeDestroy ()
			}
		}
	},

Has anybody a better idea?

Catch CKEditor mode event

Hi,

We are trying to update something on our Vue component based on the mode change in CKEDITOR.

There is an event 'mode' emitted by CKEDITOR for the same. Can we please have a listener for that event in vue-ckeditor?

Use vuejs in plugin

I've seen that we can easily add ckeditor plugins, that's great, but I'm trying to build a tight integrating with my project and for that I should have access to vuejs states and data. Is there a way to create a plugin that simply calls a VueJS method and then allows me to execute a ckeditor command to insert my custom code?

List of toolbar components

Where can I find the list of all toolbar components?

I tried using this toolbar:
[ { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] }, { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-'] }, { name: 'forms', items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] }, '/', { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv', '-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] }, { name: 'links', items : [ 'Link','Unlink'] }, { name: 'insert', items : [ 'Image','Table','HorizontalRule','SpecialChar','PageBreak'] }, '/', { name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] }, { name: 'colors', items : [ 'TextColor','BGColor' ] }, ]

But only these components appeared:
image

Text Align is missing.

error

Hello my friend , nice code .
It is giving this error to me . can you have a look ?

Thanks .
error2

SyntaxError: expected expression, got '<'

Hi! Cant resolve this problem(
What i have:

Vue-cli

in main.js :
import CKEDITOR from 'ckeditor' - (was installed with npm v 4.9.2, i have tried import ../path/ckeditor.js and require('../ckeditor/ckeditor.js') - same problem)
import VueCkeditor from 'vue-ckeditor2'
Vue.use(VueCkeditor)

in index.html:

and always have some errors:
1.[WDS] Disconnected!
2.SyntaxError: expected expression, got '<' - config.js:1
3. TypeError: c[a] is undefined

what i do wrong?

CkEditor on SPA, before destroy crash

Hello,

I'm setting up a SPA, with on the form component ckeditor. When leaving that component and loading in another one, the following error occurs:

app.js:1089 [Vue warn]: Error in beforeDestroy hook: "TypeError: Cannot read property 'clearCustomData' of null"

I've pinned it down to the following line:

this.instance.destroy()

Any idea how this could be fixed?

Thanks

Error on delete/destroy

Hey,
i get this error when i delete/destroy the ckeditor (remove it from the DOM):

Uncaught TypeError: Cannot read property 'getRanges' of null

I don't get this error message when i click inside the ckeditor (focus) before i delete the item. Can u please check this.

Thanks 👍

Multiple ckeditors on page

I want to have multiple editors on a page so I copied your code and pasted it but I still get the error

[Vue warn]: Error in mounted hook: "The editor instance "editor" is already attached to the provided element."

found in

---> at C:\Source\MedRepublic\local\public_html\node_modules\vue-ckeditor2\src\VCkeditor.vue
at C:\Source\MedRepublic\local\public_html\resources\assets\js\components\communication_center\ChatComposer.vue

My code is

<template lang="html">
  <div class="chat-composer">
      <ckeditor 
      v-model="messageText" 
      :config="ckconfig" 
      @blur="onBlur($event)" 
      @focus="onFocus($event)">
    </ckeditor>
   <ckeditor 
      v-model="contentB" 
      :config="configB"
      @blur="onBlur($event)" 
      @focus="onFocus($event)">
    </ckeditor>
      <button class="btn btn-primary pull-right submit-message" @click="sendMessage(thread, messageText)">Send Button</button>
  </div>
</template>

<script>
import Ckeditor from 'vue-ckeditor2'

export default {
    components: { Ckeditor },
    props: ['user' ,'thread'],
    data () {
        return {
            messageText: '',
            messageText2: '',
            ckconfig: {
                toolbar: [
                    [ 'Bold', 'Italic', 'Underline', '-', 'NumberedList', 'BulletedList', '-', 'Indent', 'Outdent', '-', 'Link', 'Unlink' ]
                ],
                height: 125,
                removePlugins: 'elementspath',
                resize_enabled: false
            },
            contentB: '',
            configB: {
                toolbar: [[ 'Italic' ]],
                height: 150
            }

        }
    }
}

How can I made this work?

[Question] How does ckeditor updates parent

Hello,

This is just a question in general about the component. I'm also building similar components, but I can't figure out how CkEditor is able to update the parent data, without any events.

I assume it's something to do with the v-model prop, but I don't see where it's used and / or set.

Any indicators how you're doing this?

Thank you very much! 😄

can't get sourcedialog plugin to work.. any way to use source mode ?

I may be missing something obvious but I just can't get the source mode to work.. where one can edit the html directly or paste in html

I'm using the editor in 'inline' mode

I previously was just using a cdn version of ckeditor

cdn.ckeditor.com/4.6.2/full/ckeditor.js

Then I tried to follow the instructions for adding a plugin. I realized that you first need to use a local version of ckeditor

So I downloaded the full version of ckeditor v4.9.2 and am now loading the ckeditor.js from that folder download

I also downloaded the sourcedialog plugin and put it in the plugin director

and in the config of vue-ckeditor2 I added it to extraplugins

extraPlugins: 'sourcedialog'

I'm not getting any errors, but the source button doesn't show up

in the toolbar I tried adding either "Source" or "sourcedialog" but nothing makes the button appear

        toolbar: [
          { name: 'document', items: ['Source', '-', 'sourcedialog'] },
        ],

Is there another way to have the source mode activated using this package?

How to apply Placeholder

Hello I've tried applying Placeholder on the configuration but it's not working.
Here is my sample code:

config: { toolbar: [ ['Paste','PasteFromWord','Undo', 'Redo'], ['Others'], [ 'Bold', 'Italic', 'Heading' ], ['Link'], ['NumberedList', 'BulletedList','Source','Blockquote' ,'Preview'], ['Indent','Align'] ], extraPlugins:'placeholder', placeholder:'<ul><li>Male / Female</li><li>Graduate of Internal Auditing / Accountancy or any related Business course</li><li>With at least minimum of 6 months experience on the same field but not necessary</li><li>With above average of communication skills in both oral and written English</li><li>Proficient in MS Office</li><li>Willing to be assigned in Pasig City and willing to do periodic travels to Batangas, Laguna, Cavite and Clark areas</li><li>Open to all fresh graduates&nbsp;</li></ul>', height: 200 }

error in the firefox

hello and thanks for this package :)

i used ckeditor package on vuejs template component .
but when type text on this textarea , my firefox Hang My Browser

check this problem to other pc and There is problem.
please see image :

photo_2017-07-11_15-12-35

photo_2017-07-11_15-12-29

CKEditor configuration/bug - content not posting after editing from the source

Hello,

After editing the source of a page within CKEditor and clicking save (without navigating anywhere else within the editor), the new contents are not synced.

Expected: Editing using the source view of the CKEditor should sync the content - not the seemingly unchanged WYSIWYG view contents.

Steps to reproduce

  • Select the Source toolbar option in the CKEditor
  • Edit something in the editor
  • In vue dev tools, the content hasn't been synced

Steps to workaround

Toggling the source view back to normal view, syncs the content.

Thanks,

.replace is not a function

Hi,

I downloaded via npm your package but for me it doesnt work. Simple code:

imports:

import CKEDITOR from 'ckeditor'
import editor from 'vue-ckeditor2'

component:

components: {
    editor
}

usage:

<editor v-model="content"></editor>

and I get an error:

Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_3_ckeditor___default.a.replace is not a function

I am using:
Vue >2.0
CKEDITOR >4.0

4.6 Support

Hey, I'm looking to implement CKEDITOR in Vue.js2.x. I appreciate what you're doing. It's tremendously helpful. Just wondering the compatibility or plan for supporting the new v4.6.x of CKEDITOR.

Use with CKEditor npm package

This works great when I use CKEditor from a CDN, but not when I try to use it as a package via npm, or yarn. When doing it that way, I get 'CKEDITOR is missing.' Is there something I'm missing, or am I just out of luck?

New Font

Hi
how do you add a new font to the existing ones without creating the custom_config.js file for CKEDITOR ?

I spotted that

CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here. For example:
    // config.language = 'fr';
    // config.uiColor = '#AADC6E';
config.contentsCss = 'fonts.css';
//the next line add the new font to the combobox in CKEditor
config.font_names = 'Brush Script MT Kursiv;' + config.font_names;
};

from here http://ckeditor.com/forums/CKEditor/Add-a-new-font but I dont see how that works with vue-ckeditor2

i just could do

      config: {
        toolbar: [
          { name: 'document', items: [ 'Source', '-', 'Save', 'Preview', 'Print', '-'  ] },
          { name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', '-', 'Undo', 'Redo' ] },
          { name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
          // { name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
          '/',
          { name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'CopyFormatting', 'RemoveFormat' ] },
          { name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] },
          { name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
          { name: 'insert', items: [ 'Image', 'Table', 'HorizontalRule', 'Smiley' ] },
          '/',
          { name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
          { name: 'colors', items: [ 'TextColor', 'BGColor' ] },
          { name: 'tools', items: [ 'Maximize', 'ShowBlocks' ] }
          // { name: 'about', items: [ 'About' ] }
        ],
        font_names: 'OpenDyslexic;'
      },

but that does not concate font_names with the existing one provided by CKEDITOR .

any tips ?

Bind ckeditor component to parent data

I'm quite new to Vue so I'm sorry if this is dumb but I created a Vue component exactly like the demo you provided.

I named my component 'editor' and in my html I added and sure enough I see a ckeditor box with just the format option. I used to have a textarea here that looked like

<textarea name="description" class="form-control" v-model="fillItem.description"></textarea>

I thought maybe I could just use <editor v-model="fillItem.description"></editor> but that doesn't seem to bind what's in the CKeditor to the fillItem.description. How do I connect the ckeditor component data to something else?

Value sometimes not set

Hello,

Thank you for this component!

I've got an issue were the value of ckeditor isn't filled. The weird part is this doesn't happen consistently but only some of the times.

The component call looks like so:

<ckeditor v-model="page[locale].body" :value="page[locale].body">
</ckeditor>

I'm fetching and setting the page body via a remote call with axios.

When I console.log(this.value) in the value watcher of the ckeditor component, I do see my data logged, but the ckeditor instance isn't setting the data.

Also, when I set the value after initial page load, using $vm0.page.en.body = 'asf', it doesn't set the ckeditor instance with that data. If however I change the watcher to:

this.instance.setData(this.value)

Then it does set it via console call. It does still fail on page load though.

Is there something I need to do?

Thanks!

[Bug] Infinite update loop when parent changes value prop, browser crash

Code to reproduce bug :

// TestingBug.vue
<template>
    <div>
        <ck-editor v-model="text"></ck-editor>

        <button @click="text = '<p>Lorem ipsum</p>'">Send</button>
    </div>
</template>

<script type="text/babel">
    import CkEditor from 'vue-ckeditor2'

    export default {
        data() {
            return {
                text: '<p>dolor sit amet.</p>'
            }
        },
        components: {CkEditor}
    }
</script>

Once the page is loaded, add something in the ckeditor, then click the button.

From what I've understood, the beforeUpdate of the TestingBug component is called, which in turn calls the beforeUpdate of the CkEditor component, etc.


Fix :

Use a watcher instead of a beforeUpdate hook. Replace that hook with :

    export default {
        // ...
        
        watch: {
            value(value) {
                const { id } = this;
                if (value !== CKEDITOR.instances[id].getData()) {
                    CKEDITOR.instances[id].setData(value)
                }
            }
        },
        
        // ...
    }

Error

Hello my friend . It is giving me an errro .
I am using vue 2 .

error5

Can you have a look ?

Thanks

Multiple plugins?

It there a way of adding multiple extraPlugins?

Like:

extraPlugins: 'autogrow, embed'

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.