forked from verdnatura/hedera-web
TinyMCE as node module
This commit is contained in:
parent
66bb2a57f2
commit
2fd4c05d92
1
cli.php
1
cli.php
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
@include_once __DIR__.'/environ.php';
|
||||
require_once 'vn-autoload.php';
|
||||
|
||||
$cliApp = new Vn\Lib\CliApp ('hedera-web', __DIR__.'/rest');
|
||||
|
|
|
@ -5,6 +5,8 @@ Vn.define (function () {
|
|||
Hedera.New = new Class
|
||||
({
|
||||
Extends: Hedera.Form
|
||||
|
||||
,editor: null
|
||||
|
||||
,activate: function ()
|
||||
{
|
||||
|
@ -12,30 +14,53 @@ Hedera.New = new Class
|
|||
this.$('model').setDefault ('user_id', 'news',
|
||||
new Sql.Function ({schema: 'account', name: 'userGetId'}));
|
||||
|
||||
this.$('html-editor').id = 'html-editor';
|
||||
tinymce.init ({
|
||||
mode : 'exact'
|
||||
,elements : 'html-editor'
|
||||
mode : 'exact'
|
||||
,target: this.$('html-editor')
|
||||
,plugins: [
|
||||
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
|
||||
"searchreplace wordcount visualblocks visualchars code fullscreen",
|
||||
"insertdatetime media nonbreaking save table contextmenu directionality",
|
||||
"emoticons template paste textcolor"
|
||||
"advlist autolink lists link image charmap print preview hr"
|
||||
,"anchor pagebreak searchreplace wordcount visualblocks"
|
||||
,"visualchars code fullscreen insertdatetime media nonbreaking"
|
||||
,"save table contextmenu directionality emoticons template"
|
||||
,"paste textcolor"
|
||||
]
|
||||
,toolbar1: "print preview | link image media emoticons blockquote | insertfile undo redo "
|
||||
,toolbar2: "bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"
|
||||
,toolbar3: "styleselect | fontselect fontsizeselect | forecolor backcolor "
|
||||
,toolbar1:
|
||||
" 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"
|
||||
,image_advtab: true
|
||||
,setup : function (editor)
|
||||
{
|
||||
editor.on ('init', function ()
|
||||
{
|
||||
this.getDoc().body.style.fontSize = '1em';
|
||||
});
|
||||
}
|
||||
});
|
||||
,init_instance_callback : this._onEditorInit.bind (this)
|
||||
});
|
||||
}
|
||||
|
||||
,deactivate: function ()
|
||||
{
|
||||
this.editor.destroy ();
|
||||
}
|
||||
|
||||
,_onEditorInit: function (editor)
|
||||
{
|
||||
this.editor = editor;
|
||||
editor.getDoc ().body.style.fontSize = '1em';
|
||||
this.setEditorText ();
|
||||
}
|
||||
|
||||
,setEditorText: function ()
|
||||
{
|
||||
if (!this.editor)
|
||||
return;
|
||||
|
||||
var newHtml = this.$('iter').get ('text');
|
||||
|
||||
if (!newHtml)
|
||||
newHtml = '';
|
||||
|
||||
this.editor.setContent (newHtml);
|
||||
}
|
||||
|
||||
,onStatusChange: function (form)
|
||||
{
|
||||
if (this.$('new-id').value == 0)
|
||||
|
@ -50,18 +75,12 @@ Hedera.New = new Class
|
|||
|
||||
,onBodyChange: function ()
|
||||
{
|
||||
var newHtml = this.$('iter').get ('text');
|
||||
|
||||
if (!newHtml)
|
||||
newHtml = '';
|
||||
|
||||
tinyMCE.get ('html-editor').setContent (newHtml);
|
||||
this.setEditorText ();
|
||||
}
|
||||
|
||||
,onAcceptClick: function ()
|
||||
{
|
||||
var newHtml = tinyMCE.get ('html-editor').getContent ();
|
||||
this.$('iter').set ('text', newHtml);
|
||||
this.$('iter').set ('text', this.editor.getContent ());
|
||||
this.$('iter').performOperations ();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,15 +5,12 @@
|
|||
}
|
||||
.new .box
|
||||
{
|
||||
max-width: 35em;
|
||||
max-width: 38em;
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
/* Form */
|
||||
|
||||
.new .form
|
||||
{
|
||||
}
|
||||
.new textarea
|
||||
{
|
||||
min-height: 20em;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
@include_once __DIR__.'/environ.php';
|
||||
require_once 'vn-autoload.php';
|
||||
|
||||
$webApp = new Vn\Web\App ('hedera-web');
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
|
||||
const util = require('util');
|
||||
|
||||
function SplitPlugin () {}
|
||||
|
||||
module.exports = SplitPlugin;
|
||||
|
||||
SplitPlugin.prototype.apply = function (compiler)
|
||||
{
|
||||
compiler.plugin("this-compilation", function (compilation)
|
||||
{
|
||||
compilation.plugin(["optimize-chunks", "optimize-extracted-chunks"], function (chunks)
|
||||
{
|
||||
/* console.log ("\n");
|
||||
|
||||
chunks.forEach (function processChunk (chunk, idx)
|
||||
{
|
||||
chunk.modules.forEach (function (module)
|
||||
{
|
||||
console.log (module.userRequest);
|
||||
console.log ("+"+module.resource);
|
||||
console.log ("+"+module.index);
|
||||
console.log (util.inspect (module, { showHidden: false, depth: 2 }));
|
||||
});
|
||||
});
|
||||
|
||||
console.log ("\n");
|
||||
*/ });
|
||||
});
|
||||
};
|
|
@ -32,26 +32,7 @@ module.exports =
|
|||
new SplitPlugin (),
|
||||
/* new webpack.IgnorePlugin (new RegExp ('/.{2}/(forms|pages|rest)'))
|
||||
new webpack.optimize.UglifyJsPlugin ({minimize: true})
|
||||
*/ ]
|
||||
*/ ],
|
||||
devtool: 'source-map'
|
||||
};
|
||||
/*
|
||||
var fs = require ('fs');
|
||||
|
||||
var configs = [];
|
||||
var langs = fs.readdirSync ('./locale');
|
||||
|
||||
for (var lang in languages)
|
||||
configs.push (
|
||||
{
|
||||
entry: './locale.js',
|
||||
output: {
|
||||
path: __dirname +'/build',
|
||||
filename: 'lang.'+ lang +'.js'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.json$/, loader: 'json' }
|
||||
]
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue