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
I have made a command from which users can make custom blocks by clicking on that component in canvas. Then I add that block using BlockMananger with the below code by finding the HTML and CSS of that component and their nested components.
Now, I want if a user edits that custom block in the canvas, the content should also be updated on all the custom blocks (basically components) inside the canvas and in the blocks list as well. But when I update the components inner content which are in the canvas using below code, the cursor position changes after the components method is executed. It sets the cursor position at the start of the text of the original component (in my code which is parentBlockModel) which user was initially changing. So text gets written in right to left direction. Kindly tell how to stop changing the cursor position or how to set back cursor position or any other method to update the content of the components in the canvas which were made from custom block so that cursor position does not change.
......
let newHTML2 = parentBlockModel.getEl().innerHTML;
let temp = newHTML2 + css
for (let comp of blockComponents){
if (comp.getEl() && comp.getAttributes().id != parentBlockModel.getAttributes().id){
comp.components(temp)
.....
Your feedback and assistance in this regard will be highly appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi @artf,
I have made a command from which users can make custom blocks by clicking on that component in canvas. Then I add that block using BlockMananger with the below code by finding the HTML and CSS of that component and their nested components.
bm.add(
customBlockTemplate_${blockId}
,{category: 'Custom Blocks',
attributes: {custom_block_template:true},
label:
${name}
,media: '',
content: elementHtmlCss,
})
Now, I want if a user edits that custom block in the canvas, the content should also be updated on all the custom blocks (basically components) inside the canvas and in the blocks list as well. But when I update the components inner content which are in the canvas using below code, the cursor position changes after the components method is executed. It sets the cursor position at the start of the text of the original component (in my code which is parentBlockModel) which user was initially changing. So text gets written in right to left direction. Kindly tell how to stop changing the cursor position or how to set back cursor position or any other method to update the content of the components in the canvas which were made from custom block so that cursor position does not change.
Your feedback and assistance in this regard will be highly appreciated.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions