-
Notifications
You must be signed in to change notification settings - Fork 6
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
YSHOP2-1137-v2 : Rich text editor with froala #236
Merged
Merged
Changes from 18 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
eb0c92e
Created rich text editor with froala
7c8ba24
Removed tiptap based rich text editor
364d3de
Added custom types for component props
56e3cbf
Added configuration for custom icons
f326c5b
Merge branch 'main' into YSHOP2-1137-v2
7f5ddf9
minor improvements
eihabkhan1 dde565f
Renamed custom class
f01f807
Setting default font
2d903e4
Remove duplicated code
ece2cdb
Changed font size
59c239c
Changed fullscreen exit icon
6a9781d
Merge branch 'main' into YSHOP2-1137-v2
7688793
Updated toolbar icons
3d4b06b
Merge branch 'main' into YSHOP2-1137-v2
e28eb23
Added error prop and editable toolbar
4aeb5aa
Merge branch 'main' into YSHOP2-1137-v2
d4f2fe8
Removed tiptap
2991df7
Updated pnpm-lock file
e058108
Resolving pnpm conflict
cc434c5
Updated pnpm-lock file
b156708
Merge branch 'main' into YSHOP2-1137-v2
61d4745
updated pnpm file
51d5414
Merge branch 'main' into YSHOP2-1137-v2
39e80db
minor improvments
cf4e3a5
Merge branch 'main' into YSHOP2-1137-v2
ccff987
Fixed app.vue
3509fdc
Added quick insert feature
2aa745f
removed tiptap
ce93f6c
fixed editor width
f97ffaa
Merge branch 'main' into YSHOP2-1137-v2
d13c01a
Editor improvments
4a4ced4
Merge branch 'main' into YSHOP2-1137-v2
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
}, | ||
"stylelint.validate": ["vue"], | ||
"cSpell.words": [ | ||
"youcan" | ||
] | ||
"froala", | ||
"youcan" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,33 @@ | ||
<script setup lang="ts"> | ||
import 'uno.css'; | ||
import '../assets/main.css'; | ||
import { ref, watch } from 'vue'; | ||
import { MediaInput, UploadedMedia } from '~/components'; | ||
import { ref } from 'vue'; | ||
import { RichText } from '~/components'; | ||
import type { ToolbarButtonsType } from '~/components/RichText/types'; | ||
|
||
const attachments = ref<File[]>([]); | ||
const disabled = ref(false); | ||
const limit = 4; | ||
|
||
const checkLimit = () => { | ||
disabled.value = attachments.value.length >= limit; | ||
}; | ||
|
||
const deleteFile = (file: File) => { | ||
const idx = attachments.value.indexOf(file); | ||
if (idx > -1) { | ||
attachments.value.splice(idx, 1); | ||
checkLimit(); | ||
} | ||
const content = ref(''); | ||
const error = ref(false); | ||
const license = ref('license-key'); | ||
const toolbar: ToolbarButtonsType = { | ||
text: ['fullscreen', 'bold', 'italic', 'underline', 'strikeThrough', 'textColor', 'backgroundColor', 'fontSize', 'paragraphFormat'], | ||
paragraph: ['align', 'formatOL', 'formatUL', 'outdent', 'indent'], | ||
misc: ['undo', 'redo'], | ||
rich: ['insertTable', 'insertImage', 'insertVideo', 'emoticons', 'insertLink', 'specialCharacters', 'insertHR', 'codeView', 'clear'], | ||
}; | ||
watch(attachments, () => { | ||
checkLimit(); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div class="container"> | ||
<div class="files-grid"> | ||
<UploadedMedia | ||
v-for="(attachment, index) in attachments" | ||
:key="index" | ||
:file="attachment" | ||
@delete="deleteFile(attachment)" | ||
/> | ||
</div> | ||
<MediaInput v-model="attachments" :limit="limit" :disabled="disabled" /> | ||
<div class="files-grid"> | ||
<UploadedMedia | ||
file="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885_1280.jpg" | ||
/> | ||
</div> | ||
<RichText v-model="content" :error="error" lang="ar" :license="license" :toolbar="toolbar" /> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
<style scoped lang="css"> | ||
.container { | ||
display: flex; | ||
position: relative; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
width: 300px; | ||
min-height: 140px; | ||
} | ||
|
||
.file-grid { | ||
position: absolute; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
height: 100vh; | ||
margin: 0 5%; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
// Import Froala Editor | ||
import 'froala-editor/js/plugins.pkgd.min.js'; | ||
// Import Froala Editor css files. | ||
import 'froala-editor/css/froala_editor.pkgd.min.css'; | ||
import 'froala-editor/css/froala_style.min.css'; | ||
import 'froala-editor/js/languages/ar.js'; | ||
import 'froala-editor/js/languages/fr.js'; | ||
import 'froala-editor/js/languages/en_gb.js'; | ||
import VueFroala from 'vue-froala-wysiwyg'; | ||
import { createApp } from 'vue'; | ||
import App from './App.vue'; | ||
import 'uno.css'; | ||
import '@youcan/ui-core/tokens'; | ||
|
||
const app = createApp(App, {}); | ||
|
||
app.use(VueFroala); | ||
app.mount('#app'); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
css is the default lang so we can omit this