Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.

Commit 998fb10

Browse files
author
Sohee Lee
committed
fix: add ext option and invoke method in Viewer
1 parent 3b0cbb1 commit 998fb10

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

src/Viewer.vue

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22
<div ref="tuiEditorViewer"></div>
33
</template>
44
<script>
5-
import Viewer from "tui-editor/dist/tui-editor-Viewer";
5+
import Editor from "tui-editor";
66
77
import editorEvents from "./editorEvents";
88
99
export default {
1010
name: "TuiEditorViewer",
1111
props: {
1212
height: {
13-
type: String,
14-
default: "300px"
13+
type: String
1514
},
1615
value: {
17-
type: String,
18-
default: ""
16+
type: String
17+
},
18+
exts: {
19+
type: Array
1920
}
2021
},
2122
data() {
@@ -38,18 +39,29 @@ export default {
3839
};
3940
});
4041
41-
this.editor = new Viewer({
42+
this.editor = Editor.factory({
4243
el: this.$refs.tuiEditorViewer,
4344
events: eventOption,
4445
initialValue: this.value,
45-
height: this.height
46+
height: this.height,
47+
viewer: true
4648
});
4749
},
4850
destroyed() {
4951
editorEvents.forEach(event => {
5052
this.editor.off(event);
5153
});
5254
this.editor.remove();
55+
},
56+
methods: {
57+
invoke(methodName, ...args) {
58+
let result = null;
59+
if (this.editor[methodName]) {
60+
result = this.editor[methodName](...args);
61+
}
62+
63+
return result;
64+
}
5365
}
5466
};
5567
</script>

0 commit comments

Comments
 (0)