mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Skip saving column resizes in read-only mode
Summary: This makes it so a notification about insufficient write access is no longer shown every time a user in a read-only document resizes a column. Test Plan: Browser test. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D3171
This commit is contained in:
parent
e4314f9def
commit
f8e2cc4de3
@ -890,7 +890,7 @@ GridView.prototype.buildDom = function() {
|
|||||||
dom.testId("GridView_columnLabel"),
|
dom.testId("GridView_columnLabel"),
|
||||||
kd.style('width', field.widthPx),
|
kd.style('width', field.widthPx),
|
||||||
kd.style('borderRightWidth', v.borderWidthPx),
|
kd.style('borderRightWidth', v.borderWidthPx),
|
||||||
viewCommon.makeResizable(field.width),
|
viewCommon.makeResizable(field.width, {shouldSave: !this.gristDoc.isReadonly.get()}),
|
||||||
kd.toggleClass('selected', () => ko.unwrap(this.isColSelected.at(field._index()))),
|
kd.toggleClass('selected', () => ko.unwrap(this.isColSelected.at(field._index()))),
|
||||||
dom.on('contextmenu', ev => {
|
dom.on('contextmenu', ev => {
|
||||||
// This is a little hack to position the menu the same way as with a click
|
// This is a little hack to position the menu the same way as with a click
|
||||||
|
@ -21,7 +21,7 @@ $.ui.resizable.prototype._respectSize = function() {
|
|||||||
/**
|
/**
|
||||||
* When used as an argument to dom() function, makes the containing element resizable, with the
|
* When used as an argument to dom() function, makes the containing element resizable, with the
|
||||||
* size written into the given observable. If the observable has a .save() method, it's called
|
* size written into the given observable. If the observable has a .save() method, it's called
|
||||||
* when the resize is complete (to save the new size to the server).
|
* by default when the resize is complete (to save the new size to the server).
|
||||||
* @param {Object} options.enabled: An observable, a constant, or a function for a computed
|
* @param {Object} options.enabled: An observable, a constant, or a function for a computed
|
||||||
* observable. The value is treated as a boolean, and determined whether resizable
|
* observable. The value is treated as a boolean, and determined whether resizable
|
||||||
* functionality is enabled.
|
* functionality is enabled.
|
||||||
@ -31,6 +31,8 @@ $.ui.resizable.prototype._respectSize = function() {
|
|||||||
* @param {Boolean} options.isFlex: If true, will avoid changing 'left' when resizing the left edge.
|
* @param {Boolean} options.isFlex: If true, will avoid changing 'left' when resizing the left edge.
|
||||||
* @param {Number} options.minWidth: The minimum width the element can be resized to.
|
* @param {Number} options.minWidth: The minimum width the element can be resized to.
|
||||||
* Defaults to 10 (JQuery default).
|
* Defaults to 10 (JQuery default).
|
||||||
|
* @param {Boolean} options.shouldSave: Whether .save() on `widthObservable` should be called.
|
||||||
|
* Defaults to true.
|
||||||
*/
|
*/
|
||||||
function makeResizable(widthObservable, options) {
|
function makeResizable(widthObservable, options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
@ -40,7 +42,7 @@ function makeResizable(widthObservable, options) {
|
|||||||
if (options.stop) {
|
if (options.stop) {
|
||||||
options.stop(e, ui);
|
options.stop(e, ui);
|
||||||
}
|
}
|
||||||
if (widthObservable.save) {
|
if (widthObservable.save && options.shouldSave !== false) {
|
||||||
widthObservable.save();
|
widthObservable.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user