Skip to content

Commit ba519e8

Browse files
authored
Merge pull request #721 from joomlatools/feature/720-codemirror
Codemirror not saving content
2 parents b109ac4 + 862e1a3 commit ba519e8

File tree

1 file changed

+23
-0
lines changed
  • code/libraries/joomlatools/component/koowa/template/helper

1 file changed

+23
-0
lines changed

code/libraries/joomlatools/component/koowa/template/helper/editor.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,29 @@ public function display($config = array())
7272

7373
$result .= sprintf('<ktml:style src="%s" />', $url);
7474
}
75+
76+
if ($config->editor == 'codemirror')
77+
{
78+
$result .= "<script>
79+
kQuery(function($)
80+
{
81+
let form = $('.k-js-form-controller');
82+
if (form.length)
83+
{
84+
form.on('k:submit' , function()
85+
{
86+
let editor = Joomla.editors.instances['" . $config->name . "'];
87+
let textarea = $('#" . $config->name . "');
88+
89+
if (editor && textarea.length) {
90+
textarea.html(editor.getValue());
91+
}
92+
});
93+
}
94+
});
95+
</script>
96+
";
97+
}
7598
}
7699

77100
return $result;

0 commit comments

Comments
 (0)