From 3ffd8e98bb2928a295532637322a07c20fad0290 Mon Sep 17 00:00:00 2001 From: Alec Gibson <12036746+alecgibson@users.noreply.github.com> Date: Thu, 16 Dec 2021 16:58:54 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20support=20for=20`invertWithDo?= =?UTF-8?q?c`=20for=20subtypes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change adds support for the [optional, but recommended][1] `invertWithDoc(op, doc) -> op'` method, which is already implemented as [`Delta.invert()`][2] [1]: https://github.com/ottypes/docs#optional-properties [2]: https://github.com/quilljs/delta/#invert --- lib/type.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/type.js b/lib/type.js index 9abd912..6454355 100644 --- a/lib/type.js +++ b/lib/type.js @@ -66,5 +66,11 @@ module.exports = { length: end - start, }); }, + + invertWithDoc: function(delta, doc) { + delta = new Delta(delta); + doc = new Delta(doc); + return delta.invert(doc); + } } };