Open salehliam opened 6 years ago
Hi,
I'm trying to create a tool that can increase or decrease font size of an element. The problem is that changes I make to DOM doesn't preserve. The elment goes back to its previous state after clicking the green button.
Here is the code of the plugin
`class fontSizeUp extends ContentTools.Tools.Bold
ContentTools.ToolShelf.stow(@,'fontSizeUp') @label = 'fontSizeUp' @icon = 'fontSizeUp' @tagName = 'fontSizeUp' @apply: (element, selection, callback) -> element.storeState() fontSize = element._domElement.style.fontSize unless fontSize? and fontSize element._domElement.style.fontSize = '14'; element._domElement.style.fontSize = parseInt(element._domElement.style.fontSize) + 5 element.updateInnerHtml(); element.restoreState() ContentTools.DEFAULT_TOOLS[0].push('fontSizeUp')`
Is this the right way I am trying to change font size attribute of the element or is there a better way?
Thank you for your help.
I am a newbie, I want to ask how to save the state after the user changes.
Hi,
I'm trying to create a tool that can increase or decrease font size of an element. The problem is that changes I make to DOM doesn't preserve. The elment goes back to its previous state after clicking the green button.
Here is the code of the plugin
`class fontSizeUp extends ContentTools.Tools.Bold
Is this the right way I am trying to change font size attribute of the element or is there a better way?
Thank you for your help.