2022-11-16 01:44:39 +00:00
|
|
|
import './style.scss';
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2022-11-19 00:40:28 +00:00
|
|
|
// TinyMCE
|
|
|
|
const tinymce = require('tinymce/tinymce');
|
|
|
|
require('tinymce/icons/default');
|
|
|
|
require('tinymce/themes/silver');
|
|
|
|
require('tinymce/skins/ui/oxide/skin.css');
|
|
|
|
require('tinymce/plugins/advlist');
|
|
|
|
require('tinymce/plugins/code');
|
|
|
|
require('tinymce/plugins/emoticons');
|
|
|
|
require('tinymce/plugins/emoticons/js/emojis');
|
|
|
|
require('tinymce/plugins/link');
|
|
|
|
require('tinymce/plugins/lists');
|
|
|
|
require('tinymce/plugins/table');
|
|
|
|
require('tinymce/plugins/autolink');
|
|
|
|
require('tinymce/plugins/image');
|
|
|
|
require('tinymce/plugins/charmap');
|
|
|
|
require('tinymce/plugins/print');
|
|
|
|
require('tinymce/plugins/preview');
|
|
|
|
require('tinymce/plugins/hr');
|
|
|
|
require('tinymce/plugins/anchor');
|
|
|
|
require('tinymce/plugins/pagebreak');
|
|
|
|
require('tinymce/plugins/searchreplace');
|
|
|
|
require('tinymce/plugins/wordcount');
|
|
|
|
require('tinymce/plugins/visualblocks');
|
|
|
|
require('tinymce/plugins/visualchars');
|
|
|
|
require('tinymce/plugins/code');
|
|
|
|
require('tinymce/plugins/fullscreen');
|
|
|
|
require('tinymce/plugins/insertdatetime');
|
|
|
|
require('tinymce/plugins/media');
|
|
|
|
require('tinymce/plugins/nonbreaking');
|
|
|
|
require('tinymce/plugins/save');
|
|
|
|
require('tinymce/plugins/table');
|
|
|
|
require('tinymce/plugins/directionality');
|
|
|
|
require('tinymce/plugins/emoticons');
|
|
|
|
require('tinymce/plugins/template');
|
|
|
|
require('tinymce/plugins/paste');
|
|
|
|
const contentUiCss = require('tinymce/skins/ui/oxide/content.css');
|
|
|
|
const contentCss = require('tinymce/skins/content/default/content.css');
|
2022-11-19 00:28:24 +00:00
|
|
|
|
2022-11-16 01:44:39 +00:00
|
|
|
export default new Class({
|
|
|
|
Extends: Hedera.Form,
|
|
|
|
Template: require('./ui.xml')
|
2016-10-11 07:26:10 +00:00
|
|
|
|
|
|
|
,editor: null
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
,activate() {
|
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({
|
2022-07-15 05:55:18 +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)
|
2022-11-19 00:28:24 +00:00
|
|
|
,skin: false
|
|
|
|
,content_css: false
|
|
|
|
,content_style: contentUiCss.toString() + '\n' + contentCss.toString()
|
2022-07-15 05:55:18 +00:00
|
|
|
});
|
2020-10-23 10:10:41 +00:00
|
|
|
},
|
2016-10-11 07:26:10 +00:00
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
deactivate() {
|
2020-10-23 10:10:41 +00:00
|
|
|
this.editor.destroy();
|
|
|
|
},
|
2016-10-11 07:26:10 +00:00
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
_onEditorInit(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
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
setEditorText() {
|
2016-10-11 07:26:10 +00:00
|
|
|
if (!this.editor)
|
|
|
|
return;
|
|
|
|
|
2022-07-15 05:55:18 +00:00
|
|
|
const row = this.$.iter.$;
|
|
|
|
this.editor.setContent(row ? row.text : '');
|
2020-10-23 10:10:41 +00:00
|
|
|
},
|
2016-10-11 07:26:10 +00:00
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
onStatusChange() {
|
2022-07-15 05:55:18 +00:00
|
|
|
if (!this.hash.$.new)
|
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
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
onOperationsDone() {
|
2020-10-23 10:10:41 +00:00
|
|
|
Htk.Toast.showMessage(_('NewChangedSuccessfully'));
|
|
|
|
this.onReturnClick();
|
|
|
|
},
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2022-11-19 00:28:24 +00:00
|
|
|
onReady() {
|
2020-10-23 10:10:41 +00:00
|
|
|
this.setEditorText();
|
|
|
|
},
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
onAcceptClick() {
|
2022-05-28 01:18:06 +00:00
|
|
|
this.$.iter.set('text', this.editor.getContent());
|
|
|
|
this.$.iter.performOperations();
|
2022-07-15 05:55:18 +00:00
|
|
|
},
|
|
|
|
|
2022-11-16 01:46:44 +00:00
|
|
|
onReturnClick() {
|
2022-07-15 05:55:18 +00:00
|
|
|
this.hash.setAll({form: 'news/news'});
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
});
|