Action Disable
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 61
- Joined: Tue Oct 27, 2015 11:49 am
Action Disable
Post by Konstantin »
Hello !
I use WebApp 18.0.0
I need disable action when there is changes in editor.
Actions does not have property Enable.
I tried write something like this, but it not works:
How could I do this?
I use WebApp 18.0.0
I need disable action when there is changes in editor.
Actions does not have property Enable.
I tried write something like this, but it not works:
Code: Select all
goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
window.editor = e.editor;
goog.events.listen(window.editor, sync.api.Editor.EventTypes.DIRTY_STATUS_CHANGED, function(e) {
CheckInAction.isEnabled = function() {
return !e.isDirty;
};
});
});
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Action Disable
Post by cristi_talau »
Hello,
The status (enabled or disabled) of the actions is not updated automatically. You should call the "refreshActionsStatus" method of the actions manager to trigger a status refresh.
Best,
Cristian
[1] https://www.oxygenxml.com/maven/com/oxy ... ionsStatus
The status (enabled or disabled) of the actions is not updated automatically. You should call the "refreshActionsStatus" method of the actions manager to trigger a status refresh.
Best,
Cristian
[1] https://www.oxygenxml.com/maven/com/oxy ... ionsStatus
-
- Posts: 61
- Joined: Tue Oct 27, 2015 11:49 am
Re: Action Disable
Post by Konstantin »
I did as you said but it does not work. Could you correct me
I signed to Editor after editor load.
I created new action.
Then I override method isEnabled
Then I added the action to toolbar
Then I try refresh status action by Click on button or by Changing content in editor but nothing happen.
By click button the refresh does nothing.
And listener does not called.
I signed to Editor after editor load.
Code: Select all
goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, function(e) {
window.editor = e.editor;
});
Code: Select all
CheckInAction = function(editor, docId, problemReporter) {
this.editor = editor;
this.docId = docId;
this.problemReporter = problemReporter;
};
Code: Select all
CheckInAction.prototype.isEnabled = function() {
return !this.editor.isDirty();
};
Code: Select all
goog.events.listen(workspace,
sync.api.Workspace.EventType.BEFORE_EDITOR_LOADED, function(e) {
var editor = e.editor;
var preventLeave = e.preventLeave;
var docId = e.docId;
var problemReporter = e.problemReporter;
// Register the newly created action.
editor.getActionsManager().registerAction('checkIn.action',
new CheckInAction(editor, docId, problemReporter));
addToDitaToolbar(editor, 'checkIn.action');
});
Code: Select all
CheckInAction.prototype.actionPerformed = function(callback) {
this.actionsManager.refreshActionsStatus(["checkIn.action"]);
......
};
goog.events.listen(window.editor, sync.api.Editor.EventTypes.DIRTY_STATUS_CHANGED, function(e) {
this.actionsManager.refreshActionsStatus(["checkIn.action"]);-
});
And listener does not called.
-
- Posts: 61
- Joined: Tue Oct 27, 2015 11:49 am
Re: Action Disable
Post by Konstantin »
All right
I found error for button click (not right scope of variables)
Thanks )
I found error for button click (not right scope of variables)
Thanks )
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service