Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
test:
name: Run tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10

strategy:
matrix:
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: check-case-conflict
Expand All @@ -16,34 +16,34 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 22.8.0
rev: 23.1.0
hooks:
- id: black
args: ["--line-length", "100"]

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
files: \.py$
args: [--profile=black]

- repo: https://github.com/asottile/pyupgrade
rev: v2.38.2
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/PyCQA/doc8
rev: v1.0.0
rev: v1.1.1
hooks:
- id: doc8
args: [--max-line-length=200]
exclude: docs/source/other/full-config.rst
stages: [manual]

- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
Expand Down
5 changes: 4 additions & 1 deletion javascript/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ export interface ISharedBase extends IDisposable {
/**
* Perform a transaction. While the function f is called, all changes to the shared
* document are bundled into a single event.
*
* @param f Transaction to execute
* @param undoable Whether to track the change in the action history or not (default `true`)
*/
transact(f: () => void): void;
transact(f: () => void, undoable?: boolean): void;
}

/**
Expand Down
18 changes: 9 additions & 9 deletions javascript/src/ymodels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ export class YBaseCell<Metadata extends nbformat.IBaseCellMetadata>
}
this.transact(() => {
this.ymodel.set('metadata', clone);
});
}, false);
} else {
const clone = JSONExt.deepCopy(metadata) as any;
if (clone.collapsed != null) {
Expand All @@ -789,7 +789,7 @@ export class YBaseCell<Metadata extends nbformat.IBaseCellMetadata>
if (!JSONExt.deepEqual(clone, this.getMetadata())) {
this.transact(() => {
this.ymodel.set('metadata', clone);
});
}, false);
}
}
}
Expand All @@ -811,11 +811,11 @@ export class YBaseCell<Metadata extends nbformat.IBaseCellMetadata>
* document are bundled into a single event.
*/
transact(f: () => void, undoable = true): void {
this.notebook && undoable
? this.notebook.transact(f)
: this.ymodel.doc == null
? f()
: this.ymodel.doc.transact(f, this);
!this.notebook || this.notebook.disableDocumentWideUndoRedo
? this.ymodel.doc == null
? f()
: this.ymodel.doc.transact(f, undoable ? this : null)
: this.notebook.transact(f, undoable);
}

/**
Expand Down Expand Up @@ -971,7 +971,7 @@ export class YCodeCell
if (this.ymodel.get('execution_count') !== count) {
this.transact(() => {
this.ymodel.set('execution_count', count);
});
}, false);
}
}

Expand Down Expand Up @@ -1106,7 +1106,7 @@ class YAttachmentCell
} else {
this.ymodel.set('attachments', attachments);
}
});
}, false);
}

/**
Expand Down
Loading