@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
60 lines (59 loc) • 2.46 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
import { Slice } from 'prosemirror-model';
import { ReplaceStep, Step, StepMap, StepResult } from 'prosemirror-transform';
export var tableSortingStepType = 'atlaskit-table-sorting-ordering';
export var TableSortStep = /*#__PURE__*/function (_Step) {
_inherits(TableSortStep, _Step);
var _super = _createSuper(TableSortStep);
function TableSortStep(pos, prev, next) {
var _this;
_classCallCheck(this, TableSortStep);
_this = _super.call(this);
_this.prev = prev;
_this.next = next;
_this.pos = pos;
return _this;
}
_createClass(TableSortStep, [{
key: "invert",
value: function invert() {
return new TableSortStep(this.pos, this.next, this.prev);
}
}, {
key: "apply",
value: function apply(doc) {
return StepResult.ok(doc);
}
}, {
key: "map",
value: function map() {
return null;
}
}, {
key: "getMap",
value: function getMap() {
return new StepMap([0, 0, 0]);
}
}, {
key: "toJSON",
value: function toJSON() {
return {
stepType: tableSortingStepType
};
}
}], [{
key: "fromJSON",
value: function fromJSON() {
return new ReplaceStep(0, 0, Slice.empty);
}
}]);
return TableSortStep;
}(Step);
/** Register this step with Prosemirror */
Step.jsonID(tableSortingStepType, TableSortStep);