Action ToggleSurroundWithElementOperation inconsistent
Posted: Wed Feb 15, 2017 9:29 pm
Sorry, first post. I'll read up on conventions to make this and subsequent questions better. Thanks for your attention meanwhile.
There seems to be inconsistent behavior with ToggleSurroundWithElementOperation in the following scenario:
<element>text before {startSel}text inside{endSel} text after</element>
I've found that DocBook 4 works to surround the selected text, and remove it if the same text is selected, (with <emphasis role="bold"/>, so I'm using it as an example.
This is the behavior I'm trying to implement using my own <mh:Bold> element in a custom schema. I'm starting my framework from scratch and have it validating with my schema and catalog to include the mh:Bold and others.
As far as I can tell, my action is configured exactly as the DocBook 4 one, but with "<mh:Bold/>" as the element value. However, it behaves strangely:
<diag:Overview>Every ch{cursor}ild ...</diag:Overview>
<diag:Overview>Every <mh:Bold>ch{cursor}ild</mh:Bold> ...</diag:Overview>
That's okay, but using that selection and invoking the action again, surrounds with another one:
<diag:Overview>Every <mh:Bold><mh:Bold>ch{cursor}ild</mh:Bold></mh:Bold>
That's unexpected. I thought the action would remove the surrounding <mh:Bold/>. This also does nothing when I select the entire text in <mh:Bold/> or the <mh:Bold/> element itself. This may be due to the same behavior as the following:
<diag:Overview>Every{startSel}child{endSel} ...</diag:Overview>
... nothing. The menu bar for my framework blinks, but that's it.
FYI, DITA appears broken in a similar way that mine is, with a simple <b/>. If the cursor is inside text it will surround the current "word" only if there is no text selected; just the cursor in a word. If text is selected, it will do nothing, unless the entire element (<p/>) is selected. This seems to be a problem also.
There seems to be inconsistent behavior with ToggleSurroundWithElementOperation in the following scenario:
<element>text before {startSel}text inside{endSel} text after</element>
I've found that DocBook 4 works to surround the selected text, and remove it if the same text is selected, (with <emphasis role="bold"/>, so I'm using it as an example.
This is the behavior I'm trying to implement using my own <mh:Bold> element in a custom schema. I'm starting my framework from scratch and have it validating with my schema and catalog to include the mh:Bold and others.
As far as I can tell, my action is configured exactly as the DocBook 4 one, but with "<mh:Bold/>" as the element value. However, it behaves strangely:
<diag:Overview>Every ch{cursor}ild ...</diag:Overview>
<diag:Overview>Every <mh:Bold>ch{cursor}ild</mh:Bold> ...</diag:Overview>
That's okay, but using that selection and invoking the action again, surrounds with another one:
<diag:Overview>Every <mh:Bold><mh:Bold>ch{cursor}ild</mh:Bold></mh:Bold>
That's unexpected. I thought the action would remove the surrounding <mh:Bold/>. This also does nothing when I select the entire text in <mh:Bold/> or the <mh:Bold/> element itself. This may be due to the same behavior as the following:
<diag:Overview>Every{startSel}child{endSel} ...</diag:Overview>
... nothing. The menu bar for my framework blinks, but that's it.
FYI, DITA appears broken in a similar way that mine is, with a simple <b/>. If the cursor is inside text it will surround the current "word" only if there is no text selected; just the cursor in a word. If text is selected, it will do nothing, unless the entire element (<p/>) is selected. This seems to be a problem also.