I am working on a simple collaborative editor. I am trying to implement a functionality to show/hide all images in the editor based on document attribute flag. For this, added a document attribute and from a custom menu command did the following:
All other default Steps (ReplaceStep, ReplaceAroundStep, AddMarkStep, RemoveMarkStep) works fine. I am doing this from a plugin. May be that the collab module is unaware of our custom Step(SetDocAttr), though have registered using
Step.jsonID(“SetDocAttr”, SetDocAttrStep)?
Step.fromJSON = function fromJSON (schema, json) {
if (!json || !json.stepType) { throw new RangeError(“Invalid input for Step.fromJSON”) }
var type = stepsByID[json.stepType];
When debugging the collab server module it revealed that stepsByID doesn’t have our " SetDocAttrStep". This custom step is initialised from our plugin and thus is not registered with the collab server (and registered on the client side application alone) and thus throws range error “No step type SetDocAttr defined”. Are we doing anything wrong here?
Collaboration server & Editor application (web) server (different instances) are running at different locations.
You will have to be able do deserialize the steps on the server too, unless it just passes through the JSON without ever converting it into Step instances. But not having that would result in an error, not silently not working, so that doesn’t sound like it’s the problem.