-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwsAccess.js
38 lines (37 loc) · 1.4 KB
/
wsAccess.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function applicationStarted(pluginWorkspaceAccess) {
var nullFn = function() {};
// Filter that blocks all the editing operations on the server.
var blockAllEditsFilter = new JavaAdapter(Packages.ro.sync.ecss.extensions.api.AuthorDocumentFilter, {
insertFragment: nullFn,
insertMultipleElements: nullFn,
insertMultipleFragments: nullFn,
"delete": nullFn,
deleteNode: nullFn,
multipleDelete: nullFn,
renameElement: nullFn,
setAttribute: nullFn,
removeAttribute: nullFn,
split: nullFn,
surroundWithNode: nullFn,
surroundInFragment: nullFn,
surroundInText: nullFn,
setDoctype: nullFn,
setMultipleDistinctAttributes: nullFn,
setMultipleAttributes: nullFn,
insertNode: nullFn,
insertText: nullFn
});
pluginWorkspaceAccess.addEditingSessionLifecycleListener(
new JavaAdapter(Packages.ro.sync.ecss.extensions.api.webapp.access.WebappEditingSessionLifecycleListener, {
editingSessionStarted: function (docId, authorDocumentModel) {
var authorAccess = authorDocumentModel.getAuthorAccess();
var commentsOnly = authorAccess.getEditorAccess().getEditingContext().getAttribute("commentsOnly");
if (commentsOnly === 'true') {
authorAccess.getDocumentController().setDocumentFilter(blockAllEditsFilter);
}
}
}));
}
function applicationClosing(pluginWorkspaceAccess) {
// Nothing to do.
}