danielo515 / obsidian-modal-form

Define forms for filling data that you will be able to open from anywhere you can run JS
https://danielorodriguez.com/obsidian-modal-form/
MIT License
199 stars 17 forks source link

[BUG] Cannot read properties of null (reading 'frontmatter') #189

Closed the1gofer closed 8 months ago

the1gofer commented 8 months ago

Describe the bug I believe the error may have been introduced in the update today. The result.asFrontmatterString()function seems to have stopped working. and I get the following error.

app.js:1 Uncaught TypeError: Cannot read properties of null (reading 'frontmatter')
    at isFmDisable (plugin:auto-note-mover:1806:68)
    at fileCheck (plugin:auto-note-mover:2079:13)
    at eval (plugin:auto-note-mover:2125:66)
    at e.tryTrigger (app.js:1:712355)
    at e.trigger (app.js:1:712288)
    at t.trigger (app.js:1:729920)
    at t.onChange (app.js:1:720164)
    at e.trigger (app.js:1:542391)
    at e.<anonymous> (app.js:1:540463)
    at app.js:1:237258
    at Object.next (app.js:1:237363)
    at app.js:1:236279
    at new Promise (<anonymous>)
    at v (app.js:1:236024)
    at e.reconcileFileCreation (app.js:1:539940)
    at e.<anonymous> (app.js:1:539581)
    at app.js:1:237258
    at Object.next (app.js:1:237363)
    at a (app.js:1:236081)
plugin:templater-obsidian:61 Templater Error: Template parsing error, aborting. 
 result.asFrontmatterString is not a function

To Reproduce

<%*
const modalForm = app.plugins.plugins.modalforms.api;
const result = modalForm.openForm('case');

let frontmatter = result.asFrontmatterString();
-%>
---
fileClass: Case
<% frontmatter %>
case: <% result.get('case name') %>

Expected behavior write the content of the form to a string in the YAML format.

Additional context This same code seemed to have been working for me last night, and when I went to work on the templates today, I was getting the error.

Modal forms Version: 1.34.0 Obsidian Version: 1.5.3

the1gofer commented 8 months ago

my error

danielo515 commented 8 months ago

So not an error at the end? You can use one of the shortcuts (asYaml for example) if that is easier to type

El sáb, 30 dic 2023, 3:09, the1gofer @.***> escribió:

Closed #189 https://github.com/danielo515/obsidian-modal-form/issues/189 as completed.

— Reply to this email directly, view it on GitHub https://github.com/danielo515/obsidian-modal-form/issues/189#event-11359227070, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKJWNTXZDFXAZHGL3KSMDYL5ZXBAVCNFSM6AAAAABBHFV34KVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGM2TSMRSG4YDOMA . You are receiving this because you were assigned.Message ID: @.*** com>