Skip to content

Commit

Permalink
fix editor
Browse files Browse the repository at this point in the history
  • Loading branch information
kewcoder committed Nov 14, 2023
1 parent 329d213 commit f1ff9ba
Show file tree
Hide file tree
Showing 10 changed files with 1,349 additions and 101 deletions.
Binary file modified bun.lockb
Binary file not shown.
140 changes: 49 additions & 91 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
"@astrojs/vue": "^3.0.3",
"@orchidui/vue": "^0.1.72",
"@popperjs/core": "^2.11.8",
"@vueup/vue-quill": "^1.2.0",
"dayjs": "^1.11.10",
"flag-icons": "^6.11.1",
"quill": "^2.0.0-dev.4",
"quill-delta": "^5.1.0",
"replace-in-file": "^7.0.2",
"v-calendar": "^3.1.2",
"vue-advanced-cropper": "^2.8.8"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SingleFileUpload } from "@/orchidui";
import SingleFileUpload from "./SingleFileUpload.vue";
import { ref } from "vue";

export default {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup lang="ts">
<script setup>
import { computed, onMounted, ref } from "vue";
import { Input, Button, RadioGroup, Icon, Dropdown } from "@/orchidui";
import { useUploadFileProgress } from "@/orchidui/composables/uploadFileProgress.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Theme } from "@/orchidui";
import { TextEditor } from '@/orchidui/TextEditor'
import TextEditor from './OcTextEditor.vue'
import { ref } from "vue";

export default {
Expand Down Expand Up @@ -31,7 +31,7 @@ export const Default = {
render: (args) => ({
components: { TextEditor, Theme },
setup() {
const modelValue = ref();
const modelValue = ref("default model value");
return { args, modelValue };
},
template: `
Expand Down
13 changes: 8 additions & 5 deletions packages/@orchidui-vue/src/Form/TextEditor/OcTextEditor.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<script setup>
import "@vueup/vue-quill/dist/vue-quill.snow.css";
import Quill from 'quill'
import { QuillEditor } from "./QuillEditor";
import { onMounted, ref } from "vue";
import { Quill, QuillEditor } from "@vueup/vue-quill";
import { Icon, Dropdown } from "@/orchidui";
const props = defineProps({
Expand All @@ -22,6 +23,7 @@ Size.whitelist = props.fontSizes.map((f) => f.value);
Quill.register(Size, true);
const id = ref(crypto.randomUUID().replace(/[^a-zA-Z]+/g, ""));
const localValue = ref(props.modelValue ?? '');
const isUndoActive = ref(false);
const isRedoActive = ref(false);
const isBoldActive = ref(false);
Expand All @@ -48,11 +50,11 @@ const checkStates = (value) => {
};
const undo = () => {
quill.value.getQuill().history.undo();
checkStates(props.modelValue);
checkStates(localValue.value);
};
const redo = () => {
quill.value.getQuill().history.redo();
checkStates(props.modelValue);
checkStates(localValue.value);
};
const setBold = () => {
quill.value.getQuill().format("bold", !isBoldActive.value);
Expand Down Expand Up @@ -148,7 +150,7 @@ onMounted(() => {
<QuillEditor
v-if="id"
ref="quill"
:model-value="modelValue"
:content="localValue"
theme="snow"
content-type="html"
class="min-h-[200px]"
Expand Down Expand Up @@ -347,6 +349,7 @@ onMounted(() => {
</template>
<style lang="scss">
@import url('./snow.css');
.ql-container {
@apply rounded-b text-base;
}
Expand Down
Loading

0 comments on commit f1ff9ba

Please sign in to comment.