We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
import Quill from "quill"
import { MODAL_TYPE } from "~utils"
const chipHTML = (modalType: string, value: any) => { switch (modalType) { case MODAL_TYPE.DATE_TIME_FIELD: return ' ' + value.format + "" case MODAL_TYPE.DROPDOWN_FIELD: return 'default ' + value.placeholder + "" case MODAL_TYPE.CLIPBOARD: return '' + value.type.toLowerCase() + "" case MODAL_TYPE.CURSOR: return '' + value.type.toLowerCase() + "" case MODAL_TYPE.PARAGRAPH_FIELD: case MODAL_TYPE.TEXT_FIELD: return 'default ' + value.default + "" default: return "" } }
const Inline = Quill.import("blots/inline") as any const generateUniqueId = () => shortcut-command-user-${Math.random().toString(36).substring(2, 11)}
shortcut-command-user-${Math.random().toString(36).substring(2, 11)}
class ChipBlot extends Inline { static create(value) { let node = super.create() node.setAttribute("contenteditable", "false") node.dataset.id = generateUniqueId() node.setAttribute("data-value", JSON.stringify(value)) node.classList.add(ChipBlot.className) const innerHTML = chipHTML(value.data.type, value.data) node.innerHTML = innerHTML return node }
static formats(node) { const data = JSON.parse(node.getAttribute("data-value")) return data } static value(domNode) { return domNode.dataset.id } }
ChipBlot.blotName = "chip" ChipBlot.tagName = "span" ChipBlot.className = "chip"
export default ChipBlot
version ^2.0.2
next js 14
The text was updated successfully, but these errors were encountered:
No branches or pull requests
import Quill from "quill"
import { MODAL_TYPE } from "~utils"
const chipHTML = (modalType: string, value: any) => {
switch (modalType) {
case MODAL_TYPE.DATE_TIME_FIELD:
return ' ' + value.format + ""
case MODAL_TYPE.DROPDOWN_FIELD:
return 'default ' + value.placeholder + ""
case MODAL_TYPE.CLIPBOARD:
return '' + value.type.toLowerCase() + ""
case MODAL_TYPE.CURSOR:
return '' + value.type.toLowerCase() + ""
case MODAL_TYPE.PARAGRAPH_FIELD:
case MODAL_TYPE.TEXT_FIELD:
return 'default ' + value.default + ""
default:
return ""
}
}
const Inline = Quill.import("blots/inline") as any
const generateUniqueId = () =>
shortcut-command-user-${Math.random().toString(36).substring(2, 11)}
class ChipBlot extends Inline {
static create(value) {
let node = super.create()
node.setAttribute("contenteditable", "false")
node.dataset.id = generateUniqueId()
node.setAttribute("data-value", JSON.stringify(value))
node.classList.add(ChipBlot.className)
const innerHTML = chipHTML(value.data.type, value.data)
node.innerHTML = innerHTML
return node
}
static formats(node) {
const data = JSON.parse(node.getAttribute("data-value"))
return data
}
static value(domNode) {
return domNode.dataset.id
}
}
ChipBlot.blotName = "chip"
ChipBlot.tagName = "span"
ChipBlot.className = "chip"
export default ChipBlot
version ^2.0.2
next js 14
The text was updated successfully, but these errors were encountered: