Hi there, I wrote some custom commands with modals and as I noticed that only title and id attributes can be updated automatically after closing the modal window. I also tried alt, href, src and etc. but its weren't updated. Is it some kind of discrimination or I do something wrong? :)
# Coffee
wysihtml5.commands.insertButtonLink =
exec: (composer, command, value) ->
title = if value then value.title else ''
url = if value then value.href else ''
doc = composer.doc
dom = wysihtml5.dom
tempClass = "_wysihtml5-temp-" + (+new Date())
tempClassRegExp = /non-matching-class/g
wysihtml5.commands.formatInline.exec composer, undefined, "A", tempClass, tempClassRegExp, undefined, undefined, true, true
BUTTON = doc.querySelectorAll('A.' + tempClass)[0]
if BUTTON && title
BUTTON.removeAttribute 'class'
BUTTON.setAttribute('title', title) # button title
BUTTON.setAttribute('href', url) # button href
dom.setTextContent BUTTON, title
state: (composer) ->
NODE_NAME = "A"
dom = wysihtml5.dom
node = composer.selection.getSelectedNode();
tag = undefined
checkNode = (node) ->
return node.nodeName == NODE_NAME && node.getAttribute('title') && node.getAttribute('href')
return unless node
# if current node is a TEXT
if node.nodeName == '#text' && node.parentNode.nodeName == NODE_NAME
node = node.parentNode
# if current node is a BUTTON
if node.nodeName == NODE_NAME
if checkNode(node)
title = node.getAttribute('title')
dom.setTextContent node, title
return node
else
node.remove()
So, if i click on my inserted button and and try to change title&href in modal window, only title will be changed. This is my problem.
Hi there, I wrote some custom commands with modals and as I noticed that only
title
andid
attributes can be updated automatically after closing the modal window. I also triedalt
,href
,src
and etc. but its weren't updated. Is it some kind of discrimination or I do something wrong? :)This is an example of my commands:
So, if i click on my inserted button and and try to change title&href in modal window, only
title
will be changed. This is my problem.