@slate-collaborate/types
Advanced tools
Comparing version 0.0.23 to 0.0.24
@@ -35,2 +35,15 @@ "use strict"; | ||
} | ||
else { | ||
let newPath = pathTransformer_1.pathTransform(operation.path, appliedOperation); | ||
if (operation.path[operation.path.length - 1] !== 0) { | ||
const prevPath = Path_1.Path.previous(operation.path); | ||
if (Path_1.Path.isParent(prevPath, appliedOperation.path)) { | ||
return [{ ...operation, path: newPath, position: operation.position + 1 }]; | ||
} | ||
else if (Path_1.Path.equals(prevPath, appliedOperation.path)) { | ||
return [{ ...operation, path: newPath, position: operation.position - appliedOperation.position }]; | ||
} | ||
} | ||
return [{ ...operation, path: newPath }]; | ||
} | ||
} | ||
@@ -37,0 +50,0 @@ else if (appliedOperation.type === "merge_node") { |
@@ -32,2 +32,15 @@ import { Path } from "../Path"; | ||
} | ||
else { | ||
let newPath = pathTransform(operation.path, appliedOperation); | ||
if (operation.path[operation.path.length - 1] !== 0) { | ||
const prevPath = Path.previous(operation.path); | ||
if (Path.isParent(prevPath, appliedOperation.path)) { | ||
return [{ ...operation, path: newPath, position: operation.position + 1 }]; | ||
} | ||
else if (Path.equals(prevPath, appliedOperation.path)) { | ||
return [{ ...operation, path: newPath, position: operation.position - appliedOperation.position }]; | ||
} | ||
} | ||
return [{ ...operation, path: newPath }]; | ||
} | ||
} | ||
@@ -34,0 +47,0 @@ else if (appliedOperation.type === "merge_node") { |
{ | ||
"name": "@slate-collaborate/types", | ||
"version": "0.0.23", | ||
"version": "0.0.24", | ||
"main": "dist/cjs/index.js", | ||
@@ -13,5 +13,9 @@ "types": "dist/cjs/index.d.ts", | ||
"prepare": "npm run build", | ||
"build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json" | ||
"build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^24.9.0", | ||
"jest": "^24.9.0", | ||
"ts-jest": "^24.3.0", | ||
"@types/node": "^14.0.20", | ||
@@ -18,0 +22,0 @@ "@typescript-eslint/eslint-plugin": "^3.6.0", |
330696
7656
7