Skip to content

Commit 83d5f3e

Browse files
committed
ACL - Fix sheet bugs... 404, etc.
1 parent b439523 commit 83d5f3e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

blocks/edit/da-title/da-title.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ h1 {
4646
position: absolute;
4747
width: 18px;
4848
height: 18px;
49-
top: 50%;
49+
top: 18px;
5050
left: -36px;
5151
background: url(/blocks/edit/img/Smock_LockClosed_18_N.svg) center center / 18px no-repeat;
52-
transform: translateY(-50%);
5352
}
5453

5554
.da-title-name-label {

blocks/sheet/utils/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import '../da-sheet-tabs.js';
66
const { loadStyle } = await import(`${getNx()}/scripts/nexter.js`);
77
const loadScript = (await import(`${getNx()}/utils/script.js`)).default;
88

9-
const SHEET_TEMPLATE = { sheetName: 'data' };
9+
const SHEET_TEMPLATE = { minDimensions: [20, 20], sheetName: 'data' };
1010

1111
let permissions;
1212
let canWrite;
@@ -39,7 +39,7 @@ function finishSetup(el, data) {
3939

4040
function getDefaultSheet() {
4141
return [
42-
{ ...SHEET_TEMPLATE },
42+
{ ...SHEET_TEMPLATE, minDimensions: [20, 20] },
4343
];
4444
}
4545

@@ -71,7 +71,8 @@ const getColWidths = (colWidths, headers) => {
7171

7272
function getSheet(json, sheetName) {
7373
const data = getSheetData(json.data);
74-
const templ = canWrite ? { ...SHEET_TEMPLATE, minDimensions: [20, 20] } : SHEET_TEMPLATE;
74+
const templ = { ...SHEET_TEMPLATE };
75+
if (!canWrite) delete templ.minDimensions;
7576

7677
return {
7778
...templ,
@@ -87,15 +88,16 @@ export function getPermissions() {
8788

8889
export async function getData(url) {
8990
const resp = await daFetch(url);
90-
if (!resp.ok) return getDefaultSheet();
9191

92-
// Set permissions
92+
// Set permissions even if the file is a 404
9393
const daTitle = document.querySelector('da-title');
9494
if (daTitle) daTitle.permissions = resp.permissions;
9595

9696
permissions = resp.permissions;
9797
canWrite = resp.permissions.some((permission) => permission === 'write');
9898

99+
if (!resp.ok) return getDefaultSheet();
100+
99101
const sheets = [];
100102

101103
// Get base data

blocks/sheet/utils/utils.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ function debounce(func, wait) {
1111
}
1212

1313
export const saveSheets = async (sheets) => {
14-
const daTitle = document.querySelector('da-title');
1514
document.querySelector('da-sheet-panes').data = convertSheets(sheets);
1615

1716
const { hash } = window.location;

0 commit comments

Comments
 (0)