mirror of
https://github.com/ljcoder2015/obsidian-excel.git
synced 2026-07-22 08:30:28 +00:00
feat: add sheet default rows stting
This commit is contained in:
parent
a1c620d4e2
commit
63c041ba05
7 changed files with 44 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "excel",
|
||||
"name": "Excel",
|
||||
"version": "1.3.20",
|
||||
"version": "1.3.21",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "Create spreadsheets and easily embed them in Markdown",
|
||||
"author": "ljcoder",
|
||||
|
|
|
|||
|
|
@ -115,6 +115,32 @@ export class ExcelSettingTab extends PluginSettingTab {
|
|||
})
|
||||
)
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName(t("DEFAULT_ROWS_LEN"))
|
||||
.setDesc(t("DEFAULT_ROWS_LEN_DESC"))
|
||||
.addText((text) =>
|
||||
text
|
||||
.setPlaceholder("100")
|
||||
.setValue(this.plugin.settings.defaultRowsLen)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.defaultRowsLen = value
|
||||
this.plugin.saveSettings()
|
||||
})
|
||||
)
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName(t("DEFAULT_COLS_LEN"))
|
||||
.setDesc(t("DEFAULT_COLS_LEN_DESC"))
|
||||
.addText((text) =>
|
||||
text
|
||||
.setPlaceholder("26")
|
||||
.setValue(this.plugin.settings.defaultColsLen)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.defaultColsLen = value
|
||||
this.plugin.saveSettings()
|
||||
})
|
||||
)
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName(t("SHOW_SHEET_BUTTON"))
|
||||
.setDesc(t("SHOW_SHEET_BUTTON_DESC"))
|
||||
|
|
|
|||
|
|
@ -109,8 +109,8 @@ export class ExcelView extends TextFileView {
|
|||
sheetAny.rows.len = Math.max(100, parseInt(last) + 20)
|
||||
}
|
||||
})
|
||||
this.sheet.loadData(sheetData)
|
||||
this.saveData(JSON.stringify(sheetData))
|
||||
this.refresh()
|
||||
} else {
|
||||
new Notice(t("DATA_PARSING_ERROR"));
|
||||
}
|
||||
|
|
@ -248,11 +248,11 @@ export class ExcelView extends TextFileView {
|
|||
width: () => this.contentEl.clientWidth - 32,
|
||||
},
|
||||
row: {
|
||||
len: 100,
|
||||
len: parseInt(this.plugin.settings.defaultRowsLen),
|
||||
height: parseInt(this.plugin.settings.rowHeight),
|
||||
},
|
||||
col: {
|
||||
len: 26,
|
||||
len: parseInt(this.plugin.settings.defaultColsLen),
|
||||
width: parseInt(this.plugin.settings.colWidth),
|
||||
indexWidth: 60,
|
||||
minWidth: 60,
|
||||
|
|
|
|||
|
|
@ -375,11 +375,11 @@ const createSheetEl = (
|
|||
width: () => width - 10,
|
||||
},
|
||||
row: {
|
||||
len: 100,
|
||||
len: parseInt(plugin.settings.defaultRowsLen),
|
||||
height: parseInt(plugin.settings.rowHeight),
|
||||
},
|
||||
col: {
|
||||
len: 26,
|
||||
len: parseInt(plugin.settings.defaultColsLen),
|
||||
width: parseInt(plugin.settings.colWidth),
|
||||
indexWidth: 60,
|
||||
minWidth: 60,
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ export default {
|
|||
ROW_HEIGHT_DESC: "Default row height",
|
||||
COLUMN_WIDTH: "Column Width",
|
||||
COLUMN_WIDTH_DESC: "Default column width",
|
||||
DEFAULT_ROWS_LEN: 'Default render rows',
|
||||
DEFAULT_ROWS_LEN_DESC: 'Default number of render rows',
|
||||
DEFAULT_COLS_LEN: 'Default render columns',
|
||||
DEFAULT_COLS_LEN_DESC: 'Default number of rendered columns',
|
||||
SHOW_SHEET_BUTTON: "Show Sheet Button",
|
||||
SHOW_SHEET_BUTTON_DESC: "Show Sheet Button",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ export default {
|
|||
ROW_HEIGHT_DESC: "设置表格的默认行高",
|
||||
COLUMN_WIDTH: "列宽",
|
||||
COLUMN_WIDTH_DESC: "设置表格的默认列宽",
|
||||
DEFAULT_ROWS_LEN: '默认渲染行数',
|
||||
DEFAULT_ROWS_LEN_DESC: '创建表格时默认渲染最大行数',
|
||||
DEFAULT_COLS_LEN: '默认渲染列数',
|
||||
DEFAULT_COLS_LEN_DESC: '创建表格时默认渲染最大列数',
|
||||
SHOW_SHEET_BUTTON: "显示标题按钮",
|
||||
SHOW_SHEET_BUTTON_DESC: "是否显示标题按钮",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ export interface ExcelSettings {
|
|||
colWidth: string,
|
||||
theme: string,
|
||||
showSheetButton: string,
|
||||
defaultRowsLen: string,
|
||||
defaultColsLen: string,
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: ExcelSettings = {
|
||||
|
|
@ -18,4 +20,6 @@ export const DEFAULT_SETTINGS: ExcelSettings = {
|
|||
colWidth: "100",
|
||||
theme: "light",
|
||||
showSheetButton: "true",
|
||||
defaultRowsLen: "100",
|
||||
defaultColsLen: "26",
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue