Dear Hussein,

Apologies, my question was asked in good faith, and I really didn't want to go against the spirit of the support mailing list. (This was my first message, and since the support page on the XMLMind website quite liberally states that "/You'll like this You don't need to be a list member to post a message/", I wasn't aware of any support policies.)


On 11/04/2017 10:07, Hussein Shafie wrote:
Please note that this level of support is in principle reserved to our customers. Just to prove our good will, we'll try to answer your questions the best we can. But, unless you become a customer, we are not going to answer further questions like the following ones.



This makes me appreciate your effort and useful hints even more. It has taken some time, but I now have a solution that:
    -unwraps nodes when text is being deleted right before its boundaries:
-[delete] when the caret is right before the start tag of a following element node -[delete] when the caret is at the end of the last text node inside an element node -[backspace] when the caret is right after the end tag of a preceding element node -[backspace] when the caret is at the start of the first text node inside an element node -calculates the correct caret position and moves the caret there after the node has been unwrapped Unwrapping is done via a copy operation, but the original clipboard content is restored afterwards via a variable.

In the spirit of your answer, I won't post the working code here, but just want to point out that it's possible, and that these hints have helped me a great deal. I wouldn't mind sharing at all, but respect your business concerns.


On 04/11/2017 01:41 AM, Ron Van den Branden wrote:

That is: if the caret is right before the <add> element in following
example:

    <p>This is paragraph containing <add>added text with <del>some
deletions</del> as well</add>.</p>

When the user hits the DELETE key, I would like to get following output:

    <p>This is paragraph containing added text with <del>some
deletions</del> as well.</p>

OK, but this is somewhat unusual, e.g. a word processor (most users are familiar with these) won't do something similar. Anyway, your "unwrap" command is indeed useful. See below.


Agreed, but the default delete operations make it hard to remove nodes: in the example above, the caret will just jump to the <add> element without deleting anything. That's not very word-processor-like either. Unwrapping the <add> node isn't possible via regular commands either, or at least I haven't found out how. In the project I'm setting up, I'm anticipating this might cause problems and irritations for WYSIWYG users.


Note that rather than typing what's above, I've just recorded a macro then selected "Tools|Record Macro|View". See http://www.xmlmind.com/xmleditor/_distrib/doc/help/recordMacroMenu.html


Great hint, thanks!


Note that I'm not sure that what you want to do can be implemented as a macro-command and this even if everything needed to implement this macro seems to be available.

It can :-)! (Which speaks for the expressive capacities of XMLMind's macro vocabulary.)


Of course, this can be implemented as a Java command. See http://www.xmlmind.com/xmleditor/_distrib/doc/dev/command.html



Thanks for the pointer, If only I were able to program in Java...

Anyway, thanks very much for your kind help.

Best,

Ron
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to