You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use my custom Timestamp Format, it correctly serializes as just 1 <span>, but upon deserialization (i.e. when create() is called), it renders the Timestamp twice into the DOM. It will only render twice, unless I hot-reload where it will double the amounts every time. I tried and failed to make a codepen or quilljs example but wasn't able to get either to work with this code.
Steps for Reproduction
Turn a piece of text into Timestamp blot
Refresh
After the refresh, when it deserializes the Delta and formats it, it renders twice:
The code:
importQuillfrom"quill";importInlineBlotfrom"quill/blots/inline";typeTimestampedTextValueFormat={text: string;timestamp: number};exportdefaultclassTimestampextendsInlineBlot{staticblotName="timestampedText";statictagName="span";staticclassName="timestampedText";staticcreate(value: TimestampedTextValueFormat){console.log(Quill.version);console.log("Creating timestamped text:",value);// Create the DOM nodeletnode=super.create();// Set the text contentnode.textContent=value.text;// Store the timestamp as a data attributenode.setAttribute("data-timestamp",value.timestamp.toString());// Apply styling or classnode.classList.add(this.className);node.classList.add("bg-red-400/25");// node.className = `cursor-pointer p-1 px-2 bg-red-400/25 rounded-lg mx-2`;returnnode;}/* This formats static function is commented out because another issue posting (https://github.com/slab/quill/issues/2154#issuecomment-397751348) claimed this had fixed their issue. */// static formats(domNode: HTMLElement) {// return {// text: domNode.textContent || "",// timestamp: parseInt(domNode.getAttribute("data-timestamp") || "0", 10),// };// }format(name: string,value: TimestampedTextValueFormat){if(name===this.statics.blotName&&value){// Update the timestamp and textthis.domNode.textContent=value.text;this.domNode.setAttribute("data-timestamp",value.timestamp.toString());}else{super.format(name,value);}}formats(){letformats=super.formats();formats[this.statics.blotName]={text: this.domNode.textContent||"",timestamp: parseInt(this.domNode.getAttribute("data-timestamp")||"0",10),};returnformats;}}
Expected behavior:
For a custom Format to render only once on deserialization.
Actual behavior:
Renders twice, the second render being on a new line.
Platforms:
I'm using Tauri V2.0 along with React (Not strict mode), which uses the OS' native Webview (in my case, Windows Edge WebView 2)
Version:
Quill v2.0.2 (Not react-quill)
The text was updated successfully, but these errors were encountered:
When I use my custom Timestamp Format, it correctly serializes as just 1
<span>
, but upon deserialization (i.e. whencreate()
is called), it renders the Timestamp twice into the DOM. It will only render twice, unless I hot-reload where it will double the amounts every time. I tried and failed to make a codepen or quilljs example but wasn't able to get either to work with this code.Steps for Reproduction
After the refresh, when it deserializes the Delta and formats it, it renders twice:
The code:
Expected behavior:
For a custom Format to render only once on deserialization.
Actual behavior:
Renders twice, the second render being on a new line.
Platforms:
I'm using
Tauri V2.0
along withReact
(Not strict mode), which uses the OS' native Webview (in my case, Windows Edge WebView 2)Version:
Quill v2.0.2 (Not react-quill)
The text was updated successfully, but these errors were encountered: