Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix external packages | fix text editor #72

Merged
merged 17 commits into from
Nov 14, 2023
Binary file modified bun.lockb
Binary file not shown.
9,374 changes: 3,828 additions & 5,546 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
"type": "module",
"scripts": {
"dev": "storybook dev -p 6006",
"build-storybook": "storybook build -o public/storybook",
"build:storybook": "storybook build -o public/storybook",
"astro": "astro",
"dev:playground": "astro dev",
"build": "npm run build-storybook && astro build",
"preview": "astro build && npm run build-storybook && astro preview",
"build": "npm run build:storybook && astro build",
"preview": "astro build && npm run build:storybook && astro preview",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix packages",
"format": "prettier . --write",
"publish": "cd packages/@orchidui-vue && npm run build && npm version patch && npm publish"
},
"dependencies": {
"@astrojs/vue": "^3.0.3",
"@orchidui/vue": "^0.1.72",
"@orchidui/vue": "^0.1.125",
"@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",
"replace-in-file": "^7.0.2",
"v-calendar": "^3.1.2",
"vue-advanced-cropper": "^2.8.8"
Expand Down
21 changes: 14 additions & 7 deletions packages/@orchidui-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orchidui/vue",
"version": "0.1.115",
"version": "0.1.135",
"type": "module",
"scripts": {
"build": "vite build",
Expand All @@ -24,6 +24,18 @@
".": {
"import": "./dist/index.js"
},
"./TextEditor": {
"import": "./dist/TextEditor.js"
},
"./ComplexCalendar": {
"import": "./dist/ComplexCalendar.js"
},
"./ComplexDatePicker": {
"import": "./dist/ComplexDatePicker.js"
},
"./SingleFileUpload": {
"import": "./dist/SingleFileUpload.js"
},
mykhailo-diakovych marked this conversation as resolved.
Show resolved Hide resolved
"./dist/style.css": {
"import": "./dist/style.css",
"require": "./dist/style.css"
Expand All @@ -32,10 +44,5 @@
"module": "./dist/index.js",
"files": [
"./dist"
],
"dependencies": {
"@popperjs/core": "^2.11.8",
"flag-icons": "^6.11.1",
"v-calendar": "^3.1.2"
}
]
}
4 changes: 2 additions & 2 deletions packages/@orchidui-vue/src/Builder/DataTable/OcDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ const displayFilterData = computed(() => {
!filterOptions
? 'w-full justify-end'
: isSearchExpanded
? 'md:w-fit w-full'
: ''
? 'md:w-fit w-full'
: ''
"
>
<FilterSearch
Expand Down
3 changes: 3 additions & 0 deletions packages/@orchidui-vue/src/ComplexCalendar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ComplexCalendar from "./Form/ComplexCalendar/OcComplexCalendar.vue";

export { ComplexCalendar };
3 changes: 3 additions & 0 deletions packages/@orchidui-vue/src/ComplexDatePicker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ComplexDatePicker from "./Form/ComplexDatePicker/OcComplexDatePicker.vue";

export { ComplexDatePicker };
4 changes: 2 additions & 2 deletions packages/@orchidui-vue/src/DataDisplay/Table/OcTableCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ const copyToClipboard = async (text) => {
isSelected
? 'block'
: isSimple
? ''
: 'md:hidden group-hover/row:block'
? ''
: 'md:hidden group-hover/row:block'
"
@update:model-value="$emit('selected')"
/>
Expand Down
4 changes: 2 additions & 2 deletions packages/@orchidui-vue/src/Disclosure/Tabs/OcTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const isPillVariant = computed(() => props.variant === "pills");
? 'bg-oc-gray-200 text-oc-text-500'
: 'border-oc-primary-500 text-oc-text-500'
: isPillVariant
? 'text-oc-text-400'
: 'border-transparent text-oc-text-400',
? 'text-oc-text-400'
: 'border-transparent text-oc-text-400',
]"
@click="$emit('update:modelValue', tab.value)"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
PAYMENTS_SIDEBAR_GROUP,
POS_SIDEBAR_GROUP,
ONLINE_STORE_SIDEBAR_GROUP,
} from "./HitpaySidebar.js";
} from "./HitpaySidebar.sample.js";

export default {
component: Sidebar,
Expand Down
8 changes: 4 additions & 4 deletions packages/@orchidui-vue/src/Form/Checkbox/OcCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ const onInput = () =>
? 'border-oc-primary-100 bg-oc-primary-100'
: 'border-oc-primary bg-oc-primary'
: isError
? 'border-oc-error'
: isDisabled
? 'bg-oc-primary-50 border-oc-primary-200'
: 'border-oc-primary-200',
? 'border-oc-error'
: isDisabled
? 'bg-oc-primary-50 border-oc-primary-200'
: 'border-oc-primary-200',
isError && modelValue && !isDisabled ? '!bg-oc-error ' : '',
isError && !isDisabled ? '!border-oc-error' : '',
isPartial
Comment on lines 26 to 35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The refactoring of the class bindings improves readability by separating the conditions more clearly. However, ensure that the logic for class assignment is thoroughly tested, especially since the use of !important in class names (!bg-oc-error, !border-oc-error) can lead to CSS specificity issues that might override other styles unintentionally. It's generally best to avoid !important where possible and rely on a well-structured CSS specificity hierarchy.


  • isError && modelValue && !isDisabled ? '!bg-oc-error ' : '',
  • isError && !isDisabled ? '!border-oc-error' : '',
  • isError && modelValue && !isDisabled ? 'bg-oc-error' : '',
  • isError && !isDisabled ? 'border-oc-error' : '',
If the use of `!important` is necessary due to the specificity issues that cannot be resolved otherwise, the current change is acceptable. However, if it's possible to refactor the CSS to avoid `!important`, that would be preferable for maintainability and to avoid potential conflicts in the future.



<!-- This is an auto-generated comment by CodeRabbit -->

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup>
import { ComplexCalendar, Dropdown, Input } from "@/orchidui";
import { Dropdown, Input } from "@/orchidui";
import ComplexCalendar from "../ComplexCalendar/OcComplexCalendar.vue";
import { ref } from "vue";
import dayjs from "dayjs";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup lang="ts">
<script setup>
import { Modal, Button } from "@/orchidui";
import { Cropper } from "vue-advanced-cropper";
import "vue-advanced-cropper/dist/style.css";
Expand Down

This file was deleted.

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
3 changes: 0 additions & 3 deletions packages/@orchidui-vue/src/Form/TextEditor/OcTextEditor.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TextEditor, Theme } from "@/orchidui";
import { Theme } from "@/orchidui";
import TextEditor from "./OcTextEditor.vue";
import { ref } from "vue";

export default {
kewcoder marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -30,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
20 changes: 14 additions & 6 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 lang="ts">
import "@vueup/vue-quill/dist/vue-quill.snow.css";
<script setup>
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 @@ -14,8 +15,9 @@ const props = defineProps({
*/
initialFontSize: { type: String },
modelValue: String,
image: String,
});
const emit = defineEmits(["update:modelValue"]);
const emit = defineEmits(["update:modelValue", "update:image"]);

const Size = Quill.import("attributors/style/size");
Size.whitelist = props.fontSizes.map((f) => f.value);
Expand All @@ -35,6 +37,9 @@ const activeListFormat = ref("");
const activeAlign = ref("");
const quill = ref();

// need for upload to server
const base64Images = ref(props.image);

const checkStates = (value) => {
isUndoActive.value = quill.value.getQuill().history.stack.undo.length > 0;
isRedoActive.value = quill.value.getQuill().history.stack.redo.length > 0;
Expand Down Expand Up @@ -91,6 +96,8 @@ const readImage = (base64) => {
quill.value
.getQuill()
.clipboard.dangerouslyPasteHTML(range.index, `<img src="${base64}" />`);
base64Images.value = base64;
emit("update:image", base64Images.value);
};
Comment on lines 96 to 101
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The readImage function directly sets the base64 image source into the editor's HTML. This could be a potential security risk if the base64 string is not properly sanitized. Ensure that the base64 string is validated against a known safe pattern before inserting it into the DOM.

const uploadImage = () => {
if (!quill.value.getQuill().getSelection())
Expand Down Expand Up @@ -148,11 +155,11 @@ onMounted(() => {
<QuillEditor
v-if="id"
ref="quill"
:model-value="modelValue"
:content="modelValue"
theme="snow"
content-type="html"
class="min-h-[200px]"
:toolbar="`#${id}`"
:id="`#${id}`"
@update:content="checkStates"
@paste="isValidPasedText"
>
Expand Down Expand Up @@ -350,6 +357,7 @@ onMounted(() => {
</template>

<style lang="scss">
@import url("./snow.css");
.ql-container {
@apply rounded-b text-base;
}
Expand Down
Loading