Skip to content

Commit 5746f2c

Browse files
committed
docs: 📝 fixes docs
1 parent c0a08b7 commit 5746f2c

File tree

7 files changed

+200
-20
lines changed

7 files changed

+200
-20
lines changed

docs/.vuepress/components/BasicExample.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
<template>
2-
<div class="example clearfix">
2+
<div class="example">
33
<VueEditor v-model="content" use-markdown-shortcuts />
44
</div>
55
</template>
66

77
<script>
8-
if (typeof process === undefined) {
8+
let VueEditor;
9+
if (typeof window !== "undefined") {
910
console.log("GOT WINDOW");
11+
console.log("TCL: window", window);
12+
13+
VueEditor = window.Vue2Editor.VueEditor;
1014
}
11-
const VueEditor = Vue2Editor.VueEditor;
15+
// const VueEditor = window.Vue2Editor.VueEditor;
1216
export default {
1317
components: { VueEditor },
1418
data() {
1519
return {
16-
content: "null"
20+
content: "Starting Content"
1721
};
1822
}
1923
};

docs/.vuepress/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ module.exports = {
1313
{
1414
src: "https://unpkg.com/quill"
1515
}
16-
],
16+
],
1717
[
1818
"script",
1919
{
2020
src: "https://unpkg.com/vue2-editor@alpha"
2121
}
2222
]
2323
],
24-
plugins: [require("./plugin.js")],
24+
plugins: [require("./plugin.js"), "live"],
2525
locales: {
2626
"/": {
2727
lang: "en-US",

docs/.vuepress/enhanceApp.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ export default ({
44
router, // the router instance for the app
55
siteData // site metadata
66
}) => {
7+
// NOTE: Works in DEV mode
8+
if (typeof window !== "undefined") {
9+
console.log("FROM ENHANCEAPP - GOT WINDOW");
10+
console.log("TCFROM ENHANCEAPP - window", window);
11+
12+
Vue.use(window.Vue2Editor);
13+
}
14+
Vue.mixin({
15+
data: () => ({
16+
editorContent: "Content From Mixin"
17+
}),
18+
mounted() {
19+
// import('vue2-editor').then(module => {
20+
// console.log('editor module', module);
21+
// })
22+
}
23+
});
724
// if (window !== undefined) {
825
// console.log("FROM ENHANCE: ", Vue2Editor);
926
// Vue.use(Vue2Editor);

docs/usage.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,22 @@
33
## Basic Example
44

55
<ClientOnly>
6-
<basic-example />
6+
<BasicExample />
77
</ClientOnly>
88

9+
```vue live
10+
<BasicExample />
11+
<pre>{{editorContent}}</pre>
12+
```
13+
14+
### Testing `Vue.use`
15+
16+
```vue live
17+
<VueEditor v-model="editorContent" />
18+
<pre>{{editorContent}}</pre>
19+
20+
```
21+
922
<!-- ## Customized Example
1023
1124
<customized /> -->

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"docs": "npm run docs:serve",
1818
"docs:build": "vue-cli-service docs --mode build",
1919
"docs:serve": "vue-cli-service docs --mode serve",
20+
"docs:preview": "http-server docs/.vuepress/dist",
2021
"postbuild:plugin": "rm dist/demo.html",
2122
"release": "standard-version",
2223
"release:alpha": "standard-version --prerelease alpha",
@@ -94,6 +95,7 @@
9495
"eslint-plugin-prettier": "^3.1.0",
9596
"eslint-plugin-vue": "^5.0.0",
9697
"highlight.js": "^9.15.6",
98+
"http-server": "^0.11.1",
9799
"node-sass": "^4.12.0",
98100
"querystringify": "^2.1.1",
99101
"quill-image-drop-module": "^1.0.3",
@@ -104,7 +106,8 @@
104106
"vue": "^2.6.10",
105107
"vue-cli-plugin-vplugin": "davidroyer/vue-cli-plugin-vplugin",
106108
"vue-router": "^3.0.6",
107-
"vue-template-compiler": "^2.5.21"
109+
"vue-template-compiler": "^2.5.21",
110+
"vuepress-plugin-live": "^1.1.0"
108111
},
109112
"peerDependencies": {},
110113
"eslintIgnore": [

src/plugin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
import Vue from "vue";
77
import plugin from "./index";
8+
const { Quill, version } = plugin;
9+
810
console.log("TCL: plugin", plugin);
9-
import { VueEditor, Quill, version } from "./index";
1011
console.log("TCL: version", version);
1112
console.log("TCL: Quill", Quill);
12-
console.log("TCL: VueEditor", VueEditor);
1313

1414
Vue.use(plugin);
1515

0 commit comments

Comments
 (0)