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 calling update method, the original block will be deleted and a new block will be created. This will cause the editor to flicker. The problem will be more obvious during continuous updates. The code of the recurrence problem is as follows:
conststr='when interval update this text, it will cause the editor to flicker.';awaitintervalInvoke(async(curInvokeIndex)=>{editor.blocks.update('your-block-id',{text: str.slice(0,curInvokeIndex),});},100,50);asyncfunctiondelay(ms){returnnewPromise((resolve)=>{setTimeout(()=>{resolve(0);},ms);});}asyncfunctionintervalInvoke(fn,intervalTimeMs,invokeTimes){returnnewPromise((resolve)=>{letcount=0;constinvoke=async()=>{constret=awaitfn(count);if(ret===false){returnresolve(0);}count++;if(count>=invokeTimes){returnresolve(0);}awaitdelay(intervalTimeMs);invoke();};invoke();});}
Solution
To address the issues above, we can add support for the block.update method to avoid re creation. Of course, if ToolInstance does not provide an update method, it can still be downgraded to the original creation method to achieve updates.
So, I push a PR, please help review it.
The text was updated successfully, but these errors were encountered:
The question
When calling update method, the original block will be deleted and a new block will be created. This will cause the editor to flicker. The problem will be more obvious during continuous updates. The code of the recurrence problem is as follows:
Solution
To address the issues above, we can add support for the block.update method to avoid re creation. Of course, if ToolInstance does not provide an update method, it can still be downgraded to the original creation method to achieve updates.
So, I push a PR, please help review it.
The text was updated successfully, but these errors were encountered: