obsidian-criticmarkup icon indicating copy to clipboard operation
obsidian-criticmarkup copied to clipboard

[BUG] Plugin does not start up on newer versions of Obsidian

Open SwordBlade1 opened this issue 1 year ago • 5 comments

启动插件时立即自动关闭,已更新Obsidian最新版和插件0.26最新版。 image

SwordBlade1 avatar Oct 21 '24 07:10 SwordBlade1

Having the same issue here the log when i try to activate it:

Plugin failure: commentator TypeError: Cannot destructure property 'tooltip' of 'this.states[F]' as it is undefined. at HF.attachButtons (plugin:commentator:11:114319) at HF.setRendering (plugin:commentator:11:113282) at new HF (plugin:commentator:11:113162) at mt (plugin:commentator:11:115231) at NQ.onload (plugin:commentator:39:3906167)

`Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'detachButtons')
at NQ.onunload (plugin:commentator:39:3907741)
at e.unload (app.js:1:1230613)
at e.<anonymous> (app.js:1:2382993)
at app.js:1:237228
at Object.next (app.js:1:237333)
at app.js:1:236249
at new Promise (<anonymous>)
at v (app.js:1:235994)
at e.unloadPlugin (app.js:1:2382880)
at e.<anonymous> (app.js:1:2386249)
at app.js:1:237228
at Object.next (app.js:1:237333)
at app.js:1:236249
at new Promise (<anonymous>)
at v (app.js:1:235994)
at e.disablePlugin (app.js:1:2386123)
at e.<anonymous> (app.js:1:2386910)
at app.js:1:237228
at Object.next (app.js:1:237333)
at app.js:1:236249
at new Promise (<anonymous>)
at v (app.js:1:235994)
at e.disablePluginAndSave (app.js:1:2386756)
at t.<anonymous> (app.js:1:3080276)
at app.js:1:237228
at Object.next (app.js:1:237333)
at app.js:1:236249
at new Promise (<anonymous>)
at v (app.js:1:235994)
at t.changeCallback (app.js:1:3080086)
at t.setValue (app.js:1:1405906)
at t.<anonymous> (app.js:1:3080239)
at app.js:1:237228
at Object.next (app.js:1:237333)
at a (app.js:1:236051)`

zhampu avatar Nov 06 '24 09:11 zhampu

as a temporal solution I replaced this lines in the main.ts file

async onunload(){this.previewModeHeaderButton&&this.previewModeHeaderButton.detachButtons();this.editModeHeaderModeButton&&this.editModeHeaderModeButton.detachButtons();this.postProcessor&&qC.MarkdownPreviewRenderer.unregisterPostProcessor(this.postProcessor);for(let I of this.remove_monkeys)I();this.database&&this.database.unload();window.COMMENTATOR_DEBUG=void 0}

detachButtons(){if(!this.changeEvent)return;for(let I of this.plugin.app.workspace.getLeavesOfType("markdown"))this.detachButton(I);this.plugin.app.workspace.offref(this.changeEvent);this.changeEvent=null}

now I can see the comments/edits/add/ however not sure if everyrthing is working properly

zhampu avatar Nov 06 '24 11:11 zhampu

I too, unfortunately, fail to enable this very useful plugin. I am on Obsidian 1.7.7. It was working earlier this year.

❌▶ Plugin failure: commentator TypeError: Cannot read properties of undefined (reading 'cm')
    at HF.eval [as getvalue] (plugin:commentator:14:172)
    at HF.attachButtons (plugin:commentator:11:114298)
    at HF.setRendering (plugin:commentator:11:113282)
    at new HF (plugin:commentator:11:113162)
    at mt (plugin:commentator:11:115231)
    at NQ.onload (plugin:commentator:39:3906167)
❌▶ Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'detachButtons')
    at NQ.onunload (plugin:commentator:39:3907741)
    at e.unload (app.js:1:1230640)
    at e.<anonymous> (app.js:1:2199985)
    at app.js:1:237228
    at Object.next (app.js:1:237333)
    at app.js:1:236249
    at new Promise (<anonymous>)
    at g (app.js:1:235994)
    at e.unloadPlugin (app.js:1:2199872)
    at e.<anonymous> (app.js:1:2203241)

If there is anything I can help with for reporting, triaging, testing or something, plase let me know!

@zhampu where did you make that change? I would be interested in a workaround until this gets fixed.

xmacex avatar Nov 29 '24 16:11 xmacex

Sorry everyone for the long wait! I will fix this as soon as possible. The plugin's development has officially restarted, and more updates should follow soon.

Fevol avatar Jan 19 '25 00:01 Fevol

Has this been fixed yet? I don't seem to be able to use the plugin...

kerim avatar Feb 27 '25 06:02 kerim

Apologies to everyone who has been waiting for an update. Due to personal circumstances, it has been difficult to get back to working on this plugin.

The past few days, I did some spring cleaning on the codebase in order to get it working again with the latest version of Obsidian. Version 0.2.1 is now available via BRAT. Aside from some bug fixes, it also includes live-preview rendering while editing comments.

There will very likely still be some major bugs, bear with me as I try to get all of them fixed (and add some much-needed features)!

Fevol avatar May 11 '25 18:05 Fevol