On 01/02/2015 04:34 PM, Fabián Mandelbaum wrote:
I'd need to "subvert" the delete action in the following way:
Whenever a user deletes an element, instead of actually removing it from
the document, an attribute should be set to a specific value on the
element in question (for example: revisionflag="deleted" on DocBook5).
I've tried to use customize.xxe to bind Ctrl+K to another action (tried
with "alert boo!" command) and it does not work, the element is still
deleted whenever I press Ctrl+K.
I've added
---
<command name="delete">
<macro>
<sequence>
<command name="alert" parameter="NOT DELETED" />
</sequence>
</macro>
</command>
<binding>
<keyPressed code="A" modifiers="mod" />
<command name="alert" parameter="NOT REPEATED" />
</binding>
---
to my existing customize.xxe and it works just fine:
* Ctrl-K (bound to my now custom "delete" command) shows an alert box.
* My custom Ctrl-A binding also shows an alert box.
My guess is that you have created customize.xxe by hand (as opposed to
installing the add-on called "A sample customize.xxe" using
"Options|Install Add-ons") and forgot to clear the quick start cache.
See
http://www.xmlmind.com/xmleditor/_distrib/doc/help/advancedOptions.html#cacheOptions
I've searched the docs for action specifiers and I could not find any. I
confess I did not scan the full file set under doc/ folder for XXE
deployment, but believe me I read LOTS of XXE docs.
I was wondering if I can redefine the menus and toolbars to remove all
"delete" actions I can find, and then add a "custom delete" button that
will perform the addAttribute command to set the needed attribute to the
wanted value... but supposing I can do that (I'm 99.9% sure I can), how
can I get rid of the default "delete" action so I'm sure the user cannot
use that action inadvertently (or otherwise) in a way that the only
means to "delete" an element is with my "custom delete" button?
Your first idea is the right one: simply replace all delete commands by
a custom delete commands of yours.
I'm saying *all* delete commands because for example,
* Ctrl-K is bound to: delete [implicitElement]
while:
* Del is bound to: deleteSelectionOrJoinBlockOrDeleteChar
You can list all bindings supported by a configuration by opening a
document and then selecting "Help|Mouse and Key bindings". This menu
item is present only if you turn on the "Enable the Developer Tools"
feature. See
http://www.xmlmind.com/xmleditor/_distrib/doc/help/generalOptions.html#featuresOptions
I've seen there's some application events defined, but I have not seen
such a thing as a generic "delete" (or "add") application event defined.
Even writing a custom delete command in Java is a viable option,
provided I can get rid of (or disable somehow, or replace it by mine)
the default XXE "delete" action (menu/toolbar).
I hope the scenario and constraints are clear.
I apologize in advance if what I need is explained somewhere in the doc,
and I've happen to have missed that piece of doc.
Thanks in advance for your precious help!
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support