2015-01-23 13:09:30 +00:00
|
|
|
|
2020-10-23 10:10:41 +00:00
|
|
|
Vn.include('node_modules/tinymce/tinymce.min');
|
|
|
|
Vn.define(function() {
|
|
|
|
Hedera.New = new Class({
|
2016-09-26 09:28:47 +00:00
|
|
|
Extends: Hedera.Form
|
2016-10-11 07:26:10 +00:00
|
|
|
|
|
|
|
,editor: null
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2020-10-23 10:10:41 +00:00
|
|
|
,activate: function() {
|
2022-05-28 01:18:06 +00:00
|
|
|
this.$.model.mode = Db.Model.Mode.ON_DEMAND;
|
|
|
|
this.$.model.setDefault('userFk', 'news',
|
2020-10-23 10:10:41 +00:00
|
|
|
new Sql.Function({schema: 'account', name: 'myUser_getId'}));
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2020-10-23 10:10:41 +00:00
|
|
|
tinymce.init({
|
2016-10-11 07:26:10 +00:00
|
|
|
mode : 'exact'
|
2022-05-28 01:18:06 +00:00
|
|
|
,target: this.$.htmlEditor
|
2015-02-08 15:38:38 +00:00
|
|
|
,plugins: [
|
2016-10-11 07:26:10 +00:00
|
|
|
"advlist autolink lists link image charmap print preview hr"
|
|
|
|
,"anchor pagebreak searchreplace wordcount visualblocks"
|
|
|
|
,"visualchars code fullscreen insertdatetime media nonbreaking"
|
2019-02-05 13:11:40 +00:00
|
|
|
,"save table directionality emoticons template paste"
|
2015-01-23 13:09:30 +00:00
|
|
|
]
|
2016-10-11 07:26:10 +00:00
|
|
|
,toolbar1:
|
2018-05-16 10:01:31 +00:00
|
|
|
" print preview | link image media emoticons blockquote"
|
|
|
|
+" | insertfile undo redo | bold italic"
|
|
|
|
+" | alignleft aligncenter alignright alignjustify"
|
|
|
|
+" | bullist numlist outdent indent"
|
|
|
|
+" | styleselect | fontselect fontsizeselect"
|
|
|
|
+" | forecolor backcolor"
|
2015-01-23 13:09:30 +00:00
|
|
|
,image_advtab: true
|
2020-10-23 10:10:41 +00:00
|
|
|
,init_instance_callback: this._onEditorInit.bind(this)
|
2016-10-11 07:26:10 +00:00
|
|
|
});
|
2020-10-23 10:10:41 +00:00
|
|
|
},
|
2016-10-11 07:26:10 +00:00
|
|
|
|
2020-10-23 10:10:41 +00:00
|
|
|
deactivate: function() {
|
|
|
|
this.editor.destroy();
|
|
|
|
},
|
2016-10-11 07:26:10 +00:00
|
|
|
|
2020-10-23 10:10:41 +00:00
|
|
|
_onEditorInit: function(editor) {
|
2016-10-11 07:26:10 +00:00
|
|
|
this.editor = editor;
|
2020-10-23 10:10:41 +00:00
|
|
|
editor.getDoc().body.style.fontSize = '1em';
|
|
|
|
this.setEditorText();
|
|
|
|
},
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2020-10-23 10:10:41 +00:00
|
|
|
setEditorText: function() {
|
2016-10-11 07:26:10 +00:00
|
|
|
if (!this.editor)
|
|
|
|
return;
|
|
|
|
|
2022-05-28 15:49:46 +00:00
|
|
|
var newHtml = this.$.iter.$.text;
|
2016-10-11 07:26:10 +00:00
|
|
|
|
|
|
|
if (!newHtml)
|
|
|
|
newHtml = '';
|
|
|
|
|
2020-10-23 10:10:41 +00:00
|
|
|
this.editor.setContent(newHtml);
|
|
|
|
},
|
2016-10-11 07:26:10 +00:00
|
|
|
|
2022-05-24 21:11:12 +00:00
|
|
|
onStatusChange: function() {
|
2022-05-30 01:30:33 +00:00
|
|
|
if (this.hash.$.new == 0)
|
2022-05-28 01:18:06 +00:00
|
|
|
this.$.iter.insertRow();
|
2020-10-23 10:10:41 +00:00
|
|
|
},
|
2015-03-19 19:36:11 +00:00
|
|
|
|
2020-10-23 10:10:41 +00:00
|
|
|
onOperationsDone: function() {
|
|
|
|
Htk.Toast.showMessage(_('NewChangedSuccessfully'));
|
|
|
|
this.onReturnClick();
|
|
|
|
},
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2020-10-23 10:10:41 +00:00
|
|
|
onBodyChange: function() {
|
|
|
|
this.setEditorText();
|
|
|
|
},
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2020-10-23 10:10:41 +00:00
|
|
|
onAcceptClick: function() {
|
2022-05-28 01:18:06 +00:00
|
|
|
this.$.iter.set('text', this.editor.getContent());
|
|
|
|
this.$.iter.performOperations();
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
});
|
2015-12-10 13:48:43 +00:00
|
|
|
});
|