[UX] Make the sending of an ENML note easier
Taluu opened this issue · 2 comments
Taluu commented
when using, as the examples, the PlainTextNoteContent
model to post a note content, we just have to use this class :
<?php
// ...
$note = new Note;
$note->content = new PlainTextNoteContent($content);
But if you need to use the EnmlNoteContent
instead, you need to decorate it with some XML first :
<?php
// ...
$content = <<<CONTENT
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
<en-note>$content</en-note>
CONTENT;
$note = new Note;
$note->content = new EnmlNoteContent($content);
I think something is wrong on the usage here, and that the node should be able to decorate the text itself, in order to do that :
<?php
// ...
$note = new Note;
$note->content = new EnmlNoteContent($content);
Especially as this is not documented, this can be a headache if you don't know the little tip...
Laurent-Sarrazin commented
Hi Baptiste,
Thanks for the feedback. I had this idea at one point and forgot about it.
Will certainly improve this part soon (and at least document it).
Laurent
Laurent-Sarrazin commented
Fixed by 603e978