1
私はQuillJSでsetContent関数を使用しようとしています。私は、データベースへのJSON.stringifyを使用してコンテンツを保存していた場合Quilljs setContents(json_string_with_escapes)
、それは次のようになります。私は、文字列を返すとき
{"ops":[{"insert":"\n \n"},{"attributes":{"color":"#4572a7","bold":true},"insert":"#test 1"},{"attributes":{"color":"#000000"},"insert":": "},{"insert":"\n"}]}
、PHPからのエコーjson_encodeは、このようなエスケープ文字列を生成します。
[["{\"ops\":[{\"insert\":\"\n \n\"},{\"attributes\":{\"color\":\"#4572a7\",\"bold\":true},\"insert\":\"#test 1\"},{\"attributes\":{\"color\":\"#000000\"},\"insert\":\": \"},{\"insert\":\"\n\"}]}"]]
quill.setContents機能は非常に多くのことを好きではないように思える
quill.setContents(JSON.parse(content));
quill.setContents(content));
これらのメソッドのどれもエスケープ文字列では機能しませんが、これを処理する最善の方法は何ですか?