diff --git a/docs/src/demos/Examples/Community/index.vue b/docs/src/demos/Examples/Community/index.vue
index ae7b3304..3f4f1195 100644
--- a/docs/src/demos/Examples/Community/index.vue
+++ b/docs/src/demos/Examples/Community/index.vue
@@ -2,8 +2,40 @@
-
- {{ characters }}/{{ limit }} characters
+
+
+
+
+ {{ editor.getCharacterCount() }}/{{ limit }} characters
+
@@ -98,12 +130,8 @@ export default {
},
computed: {
- characters() {
- if (this.editor) {
- return this.editor.state.doc.content.size - 2
- }
-
- return null
+ percentage() {
+ return Math.round(100 / this.limit * this.editor.getCharacterCount())
},
},
@@ -128,12 +156,22 @@ export default {
padding: 0.1rem 0.3rem;
}
-.character-limit {
+.character-count {
margin-top: 1rem;
- color: #868e96;
+ display: flex;
+ align-items: center;
+ color: #68CEF8;
&--warning {
- color: #f03e3e;
+ color: #FB5151;
+ }
+
+ &__graph {
+ margin-right: 0.5rem;
+ }
+
+ &__text {
+ color: #868e96;
}
}
diff --git a/docs/src/demos/Extensions/CharacterCount/index.vue b/docs/src/demos/Extensions/CharacterCount/index.vue
index 5304ed85..a7252827 100644
--- a/docs/src/demos/Extensions/CharacterCount/index.vue
+++ b/docs/src/demos/Extensions/CharacterCount/index.vue
@@ -2,8 +2,8 @@
-
- {{ characters }}/{{ limit }} characters
+
+ {{ editor.getCharacterCount() }}/{{ limit }} characters
@@ -45,16 +45,6 @@ export default {
})
},
- computed: {
- characters() {
- if (this.editor) {
- return this.editor.state.doc.content.size - 2
- }
-
- return null
- },
- },
-
beforeDestroy() {
this.editor.destroy()
},
@@ -69,12 +59,8 @@ export default {
}
}
-.character-limit {
+.character-count {
margin-top: 1rem;
color: #868e96;
-
- &--warning {
- color: #f03e3e;
- }
}