Skip to content

Commit

Permalink
Merge pull request #287 from Tofandel/patch-1
Browse files Browse the repository at this point in the history
fix(reactivity): correctly trigger content update if prop changes
  • Loading branch information
luthfi-hh authored Dec 20, 2022
2 parents f19a1d7 + c2544cb commit 51e3e04
Show file tree
Hide file tree
Showing 8 changed files with 4,101 additions and 3,322 deletions.
2,636 changes: 1,428 additions & 1,208 deletions demo/package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
},
"dependencies": {
"quill-blot-formatter": "^1.0.5",
"vue": "^3.0.5"
"vue": "^3.2.41"
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.2.1",
"@vue/compiler-sfc": "^3.0.5",
"typescript": "^4.1.3",
"vite": "^2.1.5",
"vue-tsc": "^0.0.15"
"@vitejs/plugin-vue": "^3.2.0",
"@vue/compiler-sfc": "^3.2.41",
"typescript": "^4.9.3",
"vite": "^3.2.4",
"vue-tsc": "^1.0.9"
}
}
Binary file removed demo/src/assets/logo.png
Binary file not shown.
33 changes: 29 additions & 4 deletions demo/src/examples/ContentType.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
<template>
<h1>Content Type</h1>
<QuillEditor v-model:content="contentDelta" contentType="delta" />
<QuillEditor
v-model:content="contentDelta"
content-type="delta"
/>
<pre>{{ contentDelta }}</pre>
<QuillEditor v-model:content="contentHTML" contentType="html" />
<QuillEditor
v-model:content="contentHTML"
content-type="html"
/>
<pre>{{ contentHTML }}</pre>
<QuillEditor v-model:content="contentText" contentType="text" />
<QuillEditor
v-model:content="contentText"
content-type="text"
/>
<pre>{{ contentText }}</pre>
<button
type="button"
@click="update"
>
Trigger external content update
</button>
</template>

<script lang="ts">
Expand All @@ -27,7 +42,17 @@ export default defineComponent({
const contentHTML = ref('<h1>This is html header</h1>')
const contentText = ref('This is just plain text')
return { contentDelta, contentHTML, contentText }
const update = () => {
contentDelta.value = new Delta([
{ insert: 'Gandalf', attributes: { bold: true } },
{ insert: ' the ' },
{ insert: 'White', attributes: { color: '#fff', background: '#000' } },
]);
contentHTML.value = '<h3>This is a different HTML header</h3>';
contentText.value = 'This is some more plain text';
}
return { contentDelta, contentHTML, contentText, update }
},
})
</script>
Expand Down
7 changes: 4 additions & 3 deletions demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{
"compilerOptions": {
"target": "esnext",
Expand All @@ -11,10 +10,12 @@
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"types": ["vite/client"],
"rootDir": ".",
"rootDir": "..",
"baseUrl": ".",
"paths": {
"@vueup/*": ["../packages/*/src"]
}
},
"skipLibCheck": true
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}
Loading

0 comments on commit 51e3e04

Please sign in to comment.