You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The max time difference between operations in milliseconds,
254
-
which still allows "UNDOABLE" operations to be composed on the undo stack.
255
-
256
249
`doc.fetch(function(err) {...})`
257
250
Populate the fields on `doc` with a snapshot of the document from the server.
258
251
@@ -273,11 +266,11 @@ same time as callbacks to `fetch` and `subscribe`.
273
266
`doc.on('create', function(source) {...})`
274
267
The document was created. Technically, this means it has a type. `source` will be `false` for ops received from the server and defaults to `true` for ops generated locally.
An operation is about to be applied to the data. `source` will be `false`for ops received from the server and defaults to `true` for ops generated locally.
An operation was applied to the data. `source` will be `false` for ops received from the server and defaults to `true` for ops generated locally.`operationType` is one of the following: `"UNDOABLE"`_(local operation that can be undone)_, `"FIXED"`_(local or remote operation that can't be undone nor redone)_, `"UNDO"`_(local undo operation that can be redone)_ and `"REDO"`_(local redo operation that can be undone)_.
272
+
`doc.on('op', function(op, source) {...})`
273
+
An operation was applied to the data. `source` will be `false` for ops received from the server and defaults to `true` for ops generated locally.
281
274
282
275
`doc.on('del', function(data, source) {...})`
283
276
The document was deleted. Document contents before deletion are passed in as an argument. `source` will be `false` for ops received from the server and defaults to `true` for ops generated locally.
@@ -302,19 +295,17 @@ Apply operation to document and send it to the server.
302
295
Call this after you've either fetched or subscribed to the document.
303
296
*`options.source` Argument passed to the `'op'` event locally. This is not sent to the server or other clients. Defaults to `true`.
304
297
*`options.skipNoop` Should processing be skipped entirely, if `op` is a no-op. Defaults to `false`.
305
-
*`options.undoable` Should it be possible to undo this operation, default=false.
306
-
*`options.fixUpUndoStack` Determines how a non-undoable operation affects the undo stack. If `false` (default), the operation transforms the undo stack, otherwise it is inverted and composed into the last operation on the undo stack.
307
-
*`options.fixUpRedoStack` Determines how a non-undoable operation affects the redo stack. If `false` (default), the operation transforms the redo stack, otherwise it is inverted and composed into the last operation on the redo stack.
298
+
*`options.undoable` Should it be possible to undo this operation. Defaults to `false`.
299
+
*`options.fixUp` If true, this operation is meant to fix the current invalid state of the snapshot. It also updates UndoManagers accordingly. This feature requires the OT type to implement `compose`.
Diff the current and the provided snapshots to generate an operation, apply the operation to the document and send it to the server.
311
303
`snapshot` structure depends on the document type.
312
304
Call this after you've either fetched or subscribed to the document.
313
305
*`options.source` Argument passed to the `'op'` event locally. This is not sent to the server or other clients. Defaults to `true`.
314
-
*`options.skipNoop` Should processing be skipped entirely, if the generated operation is a no-op. Defaults to `false`.
315
-
*`options.undoable` Should it be possible to undo this operation, default=false.
316
-
*`options.fixUpUndoStack` Determines how a non-undoable operation affects the undo stack. If `false` (default), the operation transforms the undo stack, otherwise it is inverted and composed into the last operation on the undo stack.
317
-
*`options.fixUpRedoStack` Determines how a non-undoable operation affects the redo stack. If `false` (default), the operation transforms the redo stack, otherwise it is inverted and composed into the last operation on the redo stack.
306
+
*`options.skipNoop` Should processing be skipped entirely, if `op` is a no-op. Defaults to `false`.
307
+
*`options.undoable` Should it be possible to undo this operation. Defaults to `false`.
308
+
*`options.fixUp` If true, this operation is meant to fix the current invalid state of the snapshot. It also updates UndoManagers accordingly. This feature requires the OT type to implement `compose`.
318
309
*`options.diffHint` A hint passed into the `diff`/`diffX` functions defined by the document type.
319
310
320
311
`doc.del([options][, function(err) {...}])`
@@ -330,20 +321,6 @@ Invokes the given callback function after
330
321
331
322
Note that `whenNothingPending` does NOT wait for pending `model.query()` calls.
332
323
333
-
`doc.canUndo()`
334
-
Return `true`, if there's an operation on the undo stack that can be undone, otherwise `false`.
335
-
336
-
`doc.undo([options][, function(err) {...}])`
337
-
Undo a previously applied "UNDOABLE" or "REDO" operation.
338
-
*`options.source` Argument passed to the `'op'` event locally. This is not sent to the server or other clients. Defaults to `true`.
339
-
340
-
`doc.canRedo()`
341
-
Return `true`, if there's an operation on the redo stack that can be undone, otherwise `false`.
342
-
343
-
`doc.redo([options][, function(err) {...}])`
344
-
Redo a previously applied "UNDO" operation.
345
-
*`options.source` Argument passed to the `'op'` event locally. This is not sent to the server or other clients. Defaults to `true`.
346
-
347
324
### Class: `ShareDB.Query`
348
325
349
326
`query.ready`_(Boolean)_
@@ -381,6 +358,28 @@ after a sequence of diffs are handled.
381
358
`query.on('extra', function() {...}))`
382
359
(Only fires on subscription queries) `query.extra` changed.
383
360
361
+
### Class: `ShareDB.UndoManager`
362
+
363
+
`undoManager.canUndo()`
364
+
Return `true`, if there's an operation on the undo stack that can be undone, otherwise `false`.
0 commit comments