20
20
*/
21
21
class BlogMarkdown extends MarkdownEditor
22
22
{
23
+ /**
24
+ * {@inheritDoc}
25
+ */
23
26
public function init ()
24
27
{
25
28
$ this ->viewPath = base_path ().'/modules/backend/formwidgets/markdowneditor/partials ' ;
@@ -29,12 +32,28 @@ public function init()
29
32
parent ::init ();
30
33
}
31
34
35
+ /**
36
+ * {@inheritDoc}
37
+ */
32
38
protected function loadAssets ()
33
39
{
34
40
$ this ->assetPath = '/modules/backend/formwidgets/markdowneditor/assets ' ;
35
41
parent ::loadAssets ();
36
42
}
37
43
44
+ /**
45
+ * Disable HTML cleaning on the widget level since the PostModel will handle it
46
+ *
47
+ * @return boolean
48
+ */
49
+ protected function shouldCleanHtml ()
50
+ {
51
+ return false ;
52
+ }
53
+
54
+ /**
55
+ * {@inheritDoc}
56
+ */
38
57
public function onRefresh ()
39
58
{
40
59
$ content = post ($ this ->formField ->getName ());
@@ -46,6 +65,11 @@ public function onRefresh()
46
65
];
47
66
}
48
67
68
+ /**
69
+ * Handle images being uploaded to the blog post
70
+ *
71
+ * @return void
72
+ */
49
73
protected function checkUploadPostback ()
50
74
{
51
75
if (!post ('X_BLOG_IMAGE_UPLOAD ' )) {
@@ -90,11 +114,9 @@ protected function checkUploadPostback()
90
114
];
91
115
92
116
$ response = Response::make ()->setContent ($ result );
93
- $ response -> send ( );
117
+ $ this -> controller -> setResponse ( $ response );
94
118
95
- die ();
96
- }
97
- catch (Exception $ ex ) {
119
+ } catch (Exception $ ex ) {
98
120
$ message = $ uploadedFileName
99
121
? Lang::get ('cms::lang.asset.error_uploading_file ' , ['name ' => $ uploadedFileName , 'error ' => $ ex ->getMessage ()])
100
122
: $ ex ->getMessage ();
@@ -105,9 +127,7 @@ protected function checkUploadPostback()
105
127
];
106
128
107
129
$ response = Response::make ()->setContent ($ result );
108
- $ response ->send ();
109
-
110
- die ();
130
+ $ this ->controller ->setResponse ($ response );
111
131
}
112
132
}
113
133
}
0 commit comments