Skip to content

Commit c5d253b

Browse files
authored
Merge pull request #157 from paresh-accolite/V3.2.3_PrFixes
V3.2.3 PR Fixes
2 parents e12733a + 74c0ec2 commit c5d253b

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@
1515

1616
## Installation
1717

18+
### Use with Vue CLI
19+
20+
#### Generating simple webpack boilerplate with Vue-cli
21+
22+
*Note*: you can skip this part if you already have application generated.
23+
24+
```bash
25+
npm install -g vue-cli
26+
vue init webpack-simple my-project
27+
cd my-project
28+
npm install
29+
npm run dev
30+
```
31+
32+
#### Add vue-froala-wysiwyg
33+
1834
Install `vue-froala-wysiwyg` from `npm`
1935

2036
```bash
@@ -84,6 +100,8 @@ export default {
84100

85101
#### 2. Make sure you have the right Webpack settings for loading the CSS files.
86102

103+
*Note*: you can skip this part if you created your application using boiler plate generation code stated above.
104+
87105
```javascript
88106
var webpack = require('webpack')
89107
var path = require('path')

src/vue-froala.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export default (Vue, Options = {}) => {
8989
}
9090

9191
this.currentConfig = this.clone(this.config || this.defaultConfig);
92-
this.currentConfig = {...this.currentConfig};
9392

9493
this.setContent(true);
9594

@@ -178,12 +177,21 @@ export default (Vue, Options = {}) => {
178177

179178
function htmlSet() {
180179

181-
self._editor.html.set(self.model || '');
180+
// Check if editor not null
181+
if (self._editor == null) {
182+
return;
183+
}
184+
185+
if (self._editor.html != undefined) {
186+
self._editor.html.set(self.model || '');
187+
}
182188

183189
//This will reset the undo stack everytime the model changes externally. Can we fix this?
184190

185-
self._editor.undo.saveStep();
186-
self._editor.undo.reset();
191+
if (self._editor.undo != undefined) {
192+
self._editor.undo.saveStep();
193+
self._editor.undo.reset();
194+
}
187195

188196
}
189197

@@ -217,6 +225,7 @@ export default (Vue, Options = {}) => {
217225
},
218226

219227
destroyEditor: function() {
228+
this.initEvents = [];
220229

221230
if (this._editor) {
222231

@@ -279,7 +288,12 @@ export default (Vue, Options = {}) => {
279288
var self = this;
280289

281290
this.registerEvent('initialized', function () {
282-
if (self._editor.events) {
291+
292+
// Editor initialized
293+
self.editorInitialized = true;
294+
295+
// Check if editor not null and editor has events
296+
if (self._editor != null && self._editor.events) {
283297
// bind contentChange and keyup event to froalaModel
284298
self._editor.events.on('contentChanged', function () {
285299
self.updateModel();

0 commit comments

Comments
 (0)