test js editor update with dir cmd - updated

when updating a post in the javascript editor, an error is thrown when saving.

it has something to do with the subdirectory location and the forward slashes, etc.

the editor is either incorrectly processing data coming back from the api, or the editor is sending incorrect data to the api, or maybe the api is returning malformed info.

when loading an existing page into the js editor and saving it, that works. but any follow-up saves throw the error. previews work.

Unable to open file for write. Post id: 2016/11/14/test-js-editor-update-with-dir-cmd filename: /home/wren/markup/wren.soupmode.com-20161114-2016/11/14/test-js-editor-update-with-dir-cmd.markup


made simple change in the "save" section of splitscreen.js. the returned .js after an update includes:

"original_slug":"test-post-8apr2016-1130",
"slug":"test-post-8apr2016-1130",
"dir":"2016/04/08",
"post_id":"2016/04/08/test-post-8apr2016-1130",

(now i'm confused.)

anyway, in the .js file, i decided to access slug instead of post_id.

// $('#splitscreenpostid').set('@value', obj['post_id']);
$('#splitscreenpostid').set('@value', obj['slug']);

let's see.

line one.

line two.

line three.

okay, it's working now. i wonder what happens when i change the dir command.

tested. cannot change the dir command during an update. that probably makes sense, i think. to change the file system location of the page, i would need to copy the text and then do a create and change the dir command to point to the new location.

i think the original info is used when changing the title or when using the slug command.

within this current update session, i modified the title of the post to include " - updated". the update worked fine. the slug remains the same at test-js-editor-update-with-dir-cmd.

and saving again with the new updated title works too. auto-update worked.

now what about adding the slug command. what's that do during an update? it seems like it would create a new file in the same directory location.

i added the following slug command within the javascript editor, but nothing happened. <!-- slug : fixing-js-editor -->

i'll see what happens by updating through the standard html textarea box option.

tested an update through the textarea box, and nothing different happened. i thought that a new page would be created, but that seems odd to do a create during an update.

i guess the slug command only works or means something during a create.