Skip to content

Commit 950b49a

Browse files
authored
T/51: Used config.initialData instead of innerHTML to set the initial state of the editor (#52)
Internal: Used `config.initialData` instead of `innerHTML` to set the initial state of the editor. Closes #51.
2 parents 79d5e32 + 7a22e24 commit 950b49a

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

Diff for: dist/ckeditor.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/ckeditor.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"devDependencies": {
2222
"@babel/core": "^7.0.0",
2323
"@babel/preset-env": "^7.3.1",
24-
"@ckeditor/ckeditor5-build-classic": "^11.0.1",
24+
"@ckeditor/ckeditor5-build-classic": "^12.1.0",
2525
"@ckeditor/ckeditor5-dev-env": "^13.0.2",
2626
"@ckeditor/ckeditor5-dev-utils": "^11.0.1",
2727
"@vue/test-utils": "^1.0.0-beta.29",

Diff for: src/ckeditor.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ export default {
1313
name: 'ckeditor',
1414

1515
render( createElement ) {
16-
return createElement( this.tagName, {
17-
domProps: {
18-
innerHTML: this.value || ''
19-
}
20-
} );
16+
return createElement( this.tagName );
2117
},
2218

2319
props: {
@@ -57,6 +53,12 @@ export default {
5753
},
5854

5955
mounted() {
56+
if ( this.value ) {
57+
Object.assign( this.config, {
58+
initialData: this.value
59+
} );
60+
}
61+
6062
this.editor.create( this.$el, this.config )
6163
.then( editor => {
6264
// Save the reference to the instance for further use.

Diff for: tests/ckeditor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe( 'CKEditor Component', () => {
127127
} );
128128

129129
Vue.nextTick( () => {
130-
expect( vm.$el.innerHTML ).to.equal( 'foo' );
130+
expect( vm.instance.config.initialData ).to.equal( 'foo' );
131131
expect( vm.instance.setDataCounter ).to.equal( 0 );
132132

133133
wrapper.destroy();

Diff for: tests/plugin/integration.js

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Vue.use( CKEditor );
1313
describe( 'CKEditor plugin', () => {
1414
describe( 'Vue.use()', () => {
1515
it( 'works with an actual editor build', done => {
16+
Vue.config.errorHandler = done;
17+
1618
const wrapper = mount( {
1719
template: '<ckeditor :editor="editor" @ready="onReady()" v-model="editorData"></ckeditor>',
1820
methods: {

0 commit comments

Comments
 (0)