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
|
<?php
|
||||||
|
|
||||||
|
@include_once __DIR__.'/environ.php';
|
||||||
require_once 'vn-autoload.php';
|
require_once 'vn-autoload.php';
|
||||||
|
|
||||||
$cliApp = new Vn\Lib\CliApp ('hedera-web', __DIR__.'/rest');
|
$cliApp = new Vn\Lib\CliApp ('hedera-web', __DIR__.'/rest');
|
||||||
|
|
|
@ -5,6 +5,8 @@ Vn.define (function () {
|
||||||
Hedera.New = new Class
|
Hedera.New = new Class
|
||||||
({
|
({
|
||||||
Extends: Hedera.Form
|
Extends: Hedera.Form
|
||||||
|
|
||||||
|
,editor: null
|
||||||
|
|
||||||
,activate: function ()
|
,activate: function ()
|
||||||
{
|
{
|
||||||
|
@ -12,30 +14,53 @@ Hedera.New = new Class
|
||||||
this.$('model').setDefault ('user_id', 'news',
|
this.$('model').setDefault ('user_id', 'news',
|
||||||
new Sql.Function ({schema: 'account', name: 'userGetId'}));
|
new Sql.Function ({schema: 'account', name: 'userGetId'}));
|
||||||
|
|
||||||
this.$('html-editor').id = 'html-editor';
|
|
||||||
tinymce.init ({
|
tinymce.init ({
|
||||||
mode : 'exact'
|
mode : 'exact'
|
||||||
,elements : 'html-editor'
|
,target: this.$('html-editor')
|
||||||
,plugins: [
|
,plugins: [
|
||||||
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
|
"advlist autolink lists link image charmap print preview hr"
|
||||||
"searchreplace wordcount visualblocks visualchars code fullscreen",
|
,"anchor pagebreak searchreplace wordcount visualblocks"
|
||||||
"insertdatetime media nonbreaking save table contextmenu directionality",
|
,"visualchars code fullscreen insertdatetime media nonbreaking"
|
||||||
"emoticons template paste textcolor"
|
,"save table contextmenu directionality emoticons template"
|
||||||
|
,"paste textcolor"
|
||||||
]
|
]
|
||||||
,toolbar1: "print preview | link image media emoticons blockquote | insertfile undo redo "
|
,toolbar1:
|
||||||
,toolbar2: "bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"
|
" print preview | link image media emoticons blockquote"
|
||||||
,toolbar3: "styleselect | fontselect fontsizeselect | forecolor backcolor "
|
+"| insertfile undo redo | bold italic"
|
||||||
|
+"| alignleft aligncenter alignright alignjustify"
|
||||||
|
+"| bullist numlist outdent indent"
|
||||||
|
+"| styleselect | fontselect fontsizeselect"
|
||||||
|
+"| forecolor backcolor"
|
||||||
,image_advtab: true
|
,image_advtab: true
|
||||||
,setup : function (editor)
|
,init_instance_callback : this._onEditorInit.bind (this)
|
||||||
{
|
});
|
||||||
editor.on ('init', function ()
|
|
||||||
{
|
|
||||||
this.getDoc().body.style.fontSize = '1em';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
,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)
|
,onStatusChange: function (form)
|
||||||
{
|
{
|
||||||
if (this.$('new-id').value == 0)
|
if (this.$('new-id').value == 0)
|
||||||
|
@ -50,18 +75,12 @@ Hedera.New = new Class
|
||||||
|
|
||||||
,onBodyChange: function ()
|
,onBodyChange: function ()
|
||||||
{
|
{
|
||||||
var newHtml = this.$('iter').get ('text');
|
this.setEditorText ();
|
||||||
|
|
||||||
if (!newHtml)
|
|
||||||
newHtml = '';
|
|
||||||
|
|
||||||
tinyMCE.get ('html-editor').setContent (newHtml);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
,onAcceptClick: function ()
|
,onAcceptClick: function ()
|
||||||
{
|
{
|
||||||
var newHtml = tinyMCE.get ('html-editor').getContent ();
|
this.$('iter').set ('text', this.editor.getContent ());
|
||||||
this.$('iter').set ('text', newHtml);
|
|
||||||
this.$('iter').performOperations ();
|
this.$('iter').performOperations ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,15 +5,12 @@
|
||||||
}
|
}
|
||||||
.new .box
|
.new .box
|
||||||
{
|
{
|
||||||
max-width: 35em;
|
max-width: 38em;
|
||||||
padding: 2em;
|
padding: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Form */
|
/* Form */
|
||||||
|
|
||||||
.new .form
|
|
||||||
{
|
|
||||||
}
|
|
||||||
.new textarea
|
.new textarea
|
||||||
{
|
{
|
||||||
min-height: 20em;
|
min-height: 20em;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
@include_once __DIR__.'/environ.php';
|
||||||
require_once 'vn-autoload.php';
|
require_once 'vn-autoload.php';
|
||||||
|
|
||||||
$webApp = new Vn\Web\App ('hedera-web');
|
$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 SplitPlugin (),
|
||||||
/* new webpack.IgnorePlugin (new RegExp ('/.{2}/(forms|pages|rest)'))
|
/* new webpack.IgnorePlugin (new RegExp ('/.{2}/(forms|pages|rest)'))
|
||||||
new webpack.optimize.UglifyJsPlugin ({minimize: true})
|
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