示例#1
0
  this.onGraphUpdate = function(op) {
    // Call super handler and return if that has processed the operation already
    if (__super__.onGraphUpdate.call(this, op)) {
      return true;
    }

    // Otherwise deal with annotation changes
    if (Annotator.changesAnnotations(this.node.document, op, [this.node.id, "content"])) {
      if (op.type === "create" || op.type === "delete" ||
          op.path[1] === "path" || op.path[1] === "range") {

        this.renderContent();
        return true;
      }
    }
    return false;
  };
示例#2
0
文件: text_view.js 项目: jure/nodes
  this.onGraphUpdate = function(op) {
    // Call super handler and return if that has processed the operation already
    if (NodeView.prototype.onGraphUpdate.call(this, op)) {
      return true;
    }


    // Otherwise deal with annotation changes
    if (Annotator.changesAnnotations(this.node.document, op, [this.node.id, this.property])) {
      if (op.type === "create" || op.type === "delete") {
        console.log("Rerendering TextView due to annotation update", op);
        this.renderContent();
        return true;
      }
    }

    return false;
  };
示例#3
0
  this.onGraphUpdate = function(op) {
    // Call super handler and return if that has processed the operation already
    if (NodeView.prototype.onGraphUpdate.call(this, op)) {
      return true;
    }

    if (_.isEqual(op.path, ["document","title"])) {
      this.titleView.renderContent();
      return true;
    } else if (_.isEqual(op.path, ["document", "authors"])) {
      this.renderAuthors();
    }

    // Otherwise deal with annotation changes
    // Note: the annotations do not get attached to ["document", "title"],
    // as it seems strange to annotate a property which is used in such an indirect way
    if (Annotator.changesAnnotations(this.node.document, op, ["cover", "title"])) {
      //console.log("Rerendering TextView due to annotation update", op);
      this.titleView.renderContent();
      return true;
    }
  };