Skip to content

Commit

Permalink
prepare for next release & update version info
Browse files Browse the repository at this point in the history
  • Loading branch information
yo-goto committed Sep 18, 2021
1 parent 5701dd2 commit 41e08b1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 41 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"minAppVersion": "0.12.13",
"authorUrl": "/~https://github.com/yo-goto",
"description": "Enable to view your notes as cards.",
"version": "0.4.5",
"version": "0.4.6",
"isDesktopOnly": false
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-card-view-mode",
"version": "0.4.5",
"version": "0.4.6",
"description": "Card View Mode & Attention Pane. View notes as cards!",
"main": "main.js",
"scripts": {
Expand Down
43 changes: 4 additions & 39 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,11 @@ export default class CardViewModePlugin extends Plugin {
}

enable = () => {
// this.registerEvent(this.app.workspace.on('resize', this.handleResize));

this.app.workspace.onLayoutReady(this.reallyEnable);
}


reallyEnable = () => {
this.addStyle();
// this.observeLeafWidth();
}

disable = () => {
Expand All @@ -45,7 +41,6 @@ export default class CardViewModePlugin extends Plugin {

refresh = () => {
this.updateStyle()
// this.observeLeafWidth();
}

removeStyle = () => {
Expand All @@ -58,20 +53,17 @@ export default class CardViewModePlugin extends Plugin {
addStyle = () => {
this.style.setAttribute('type', 'text/css');

// add style in head tag
document.getElementsByTagName("head")[0].appendChild(this.style);
document.body.classList.add('plugin-card-view-mode');
this.updateStyle();
}

updateStyle = () => {
// 1. remove style before changing
// this.removeStyle();
// これやるとスタイル更新されない

// 2-a. update boolean settings
// 1-a. update boolean settings
document.body.classList.toggle('plugin-card-view-mode-cardtitle', this.settings.cardTitle);

// 2-b. update custom css properties
// 1-b. update custom css properties
const el = this.style;
if (!el) throw "plugin-card-view-mode element not found!";
else {
Expand All @@ -95,33 +87,6 @@ export default class CardViewModePlugin extends Plugin {
`;
}
}

// handleResize = () => {
// if (this.app.workspace.layoutReady) {
// this.observeLeafWidth();
// }
// }

// observeLeafWidth = () => {
// const cardTitleWidthList = <NodeListOf<HTMLElement>>document.querySelectorAll('.embedded-note-titles .CodeMirror-scroll>h1[id*="title-"]');
// const paneLeafWidth = <NodeListOf<HTMLElement>>document.querySelectorAll('.CodeMirror-sizer .CodeMirror-lines>div[role="presentation"]');


// const resizeObserver = new ResizeObserver(entries => {

// for(let i = 0; i < entries.length; i++) {
// let entry = entries[i];
// if(entry.contentRect){
// cardTitleWidthList[i].style.width = String(entry.contentRect.width + 6) + `px`;
// }
// }
// });

// for(let k =0; k < paneLeafWidth.length; k++){
// resizeObserver.observe(paneLeafWidth[k]);
// }
// }



}

1 change: 1 addition & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"0.4.6": "0.12.13",
"0.4.5": "0.12.13",
"0.4.4": "0.12.13",
"0.4.3": "0.12.13",
Expand Down

0 comments on commit 41e08b1

Please sign in to comment.