Comments (6)
i used 'clipboard' as the module object's key
That was the solution. See this sandbox. Everything should work just fine this way.
I'll add a demo for vue-quill to the readme as soon as I find some time.
from quill-paste-smart.
Hi @MiniJude
I don't fully understand what you mean. Are you asking how to use it in Ecma Script? If so, refer to the docs.
Besides that.. what do you need the modules default export for? there is nothing you can do with it in your code (at least i can not think of anything)
from quill-paste-smart.
Hi @MiniJude I don't fully understand what you mean. Are you asking how to use it in Ecma Script? If so, refer to the docs. Besides that.. what do you need the modules default export for? there is nothing you can do with it in your code (at least i can not think of anything)
Thank you for your reply! I'm sorry i wasn't clear :)
I need to use the paste plug-in on the component VueQuill. I saw your demo . But options are not used in this example, which is what i want to do.
My current solution is to download the module.js file and use it this way:
<template>
<QuillEditor ref="editorRef" :content="content" contentType="html" :toolbar="defaultToolBar" :modules="modules" theme="snow" />
</template>
<script lang="ts" setup>
import { onMounted, ref, watch } from 'vue'
// @ts-expect-error
import BlotFormatter from 'quill-blot-formatter/dist/BlotFormatter'
// @ts-expect-error
import PasteSmart from './pasteSmartModule.js' // this is your module.js
const props = withDefaults(
defineProps<{
content: string
}>(),
{
content: '',
}
)
const emits = defineEmits<{
(event: 'update:content', content: string): void
}>()
const editorRef = ref()
const defaultToolBar = [['bold', 'italic', 'underline'], ['image'], ['formula']]
const modules = [
{
name: 'blotFormatter',
module: BlotFormatter
},
{
name: 'clipboard',
module: PasteSmart,
options: {
allowed: {
tags: ['a', 'b', 'strong', 'u', 's', 'i', 'p', 'br', 'ul', 'ol', 'li', 'img'],
attributes: ['href', 'rel', 'target', 'class', 'src']
},
keepSelection: true,
substituteBlockElements: true,
}
}
]
</script>
from quill-paste-smart.
Ok, I peeked into vue-quill and tried to reproduce your issue.
I could not find any issue with importing the module by import QuillPasteSmart from 'quill-paste-smart'
.
But @vueup/vue-quill
seems to fire the paste event twice. This results in duplicate content.
For now I have no idea how to prevent this from happening. Tbh I think its an issue with @vueup/vue-quill
since it does not happen in vanilla quill (or any other derivation I know of).
I'll try to find some time to tackle this.
from quill-paste-smart.
Ok, I peeked into vue-quill and tried to reproduce your issue. I could not find any issue with importing the module by
import QuillPasteSmart from 'quill-paste-smart'
. But@vueup/vue-quill
seems to fire the paste event twice. This results in duplicate content. For now I have no idea how to prevent this from happening. Tbh I think its an issue with@vueup/vue-quill
since it does not happen in vanilla quill (or any other derivation I know of). I'll try to find some time to tackle this.
Every plug-in in 'modules' object will be registered into quill editor by @vueup/vue-quill, and the quill-paste-smart has registered by itemself. So it caused two triggers?
my code does not trigger twice. i used 'clipboard' as the module object's key. but yours is 'QuillPasteSmart', which is different from the one used when registering your component.
Perhaps my guess is wrong. Looking forward to your answer.
from quill-paste-smart.
Every plug-in in 'modules' object will be registered into quill editor by @vueup/vue-quill, and the quill-paste-smart has registered by itemself. So it caused two triggers?
That was my first thought also. But it seems not to be the case. vue-quill does not register the plugin (at least not correctly). I get an error if I remove the "register itself" bit.
from quill-paste-smart.
Related Issues (20)
- Plugin fails if toolbar: false -> Cannot read property 'controls' of undefined HOT 4
- Possible to limit the images someone can paste? HOT 3
- Pasting code is not working as expected HOT 3
- substituteBlockElements feature destroys attributes even on permitted blocks, breaking copy/paste for checklists HOT 5
- Problem with paste mention. HOT 4
- Adding IMG (or Image in toolbar) does not permit base64 images pasted from clipboard HOT 1
- Pasting multiline text from Outlook/Teams adds redundant space lines HOT 8
- Angular warning for CommonJS HOT 2
- quill scroll to top while onPaste triggered HOT 4
- Italic format doesn't include 'em' HOT 2
- Add this module on Vue 3 HOT 2
- Adding "allowed" tags/attributes not working HOT 2
- [BUG] Unable to create custom matchers for Node.TEXT_NODE when using this extension HOT 1
- [BUG] The module makes applications vulnerable to XSS HOT 2
- how do i prevent pasting when the content is only img? HOT 1
- copy/paste from word not working for alignment HOT 8
- getAllowed(quill-paste-smart/dist/quill-paste-smart) error Cannot read property 'controls' of undefined HOT 4
- How to allow quill mention chars? HOT 2
- Iframes? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quill-paste-smart.