cakedc / tinymce Goto Github PK
View Code? Open in Web Editor NEWTinyMCE Javascript HTML WYSIWYG Plugin for CakePHP
License: Other
TinyMCE Javascript HTML WYSIWYG Plugin for CakePHP
License: Other
See my comment on #7 (comment)
Hello,
I'm using the latest stable version of CakePHP 4.x, the latest version of the CakeDC/TinyMCE plugin, and the latest jQuery. I have followed your instructions for installing the plugin.
I use the following code in my view to enable the tinymce editor for my textareas:
$this->TinyMCE->editor(['theme' => 'modern', 'selector' => 'textarea']);
The editor is loaded for the first textarea, but with the following error displayed inside the textarea:
Failed to load plugin: style from url http://cdn.tinymce.com/4/plugins/style/plugin.min.js
The other textareas do not show up. The rendered HTML for these look like:
<textarea name="tickets_prices" id="tickets-prices" rows="5" style="visibility: hidden;"></textarea>
Of course if I disable the helper initialization these textareas are no longer invisible.
Any suggestions would be greatly appreciated!
Thank you
As I read in the documentation, we should set the $config
array with the settings we want.
But the question is: where we would place this piece of code?
Directly in this property declaration, inside the class? Or is there a better place to configure this helper?
Nothing more to say than: No test passes. Also the test definitions produce strict warnings.
I am using the plugin as it is mentioned in the documentation. Somewhere it is working fine with no issues. But in some part of my application, basically, where the methods are prefixed with admin, it is not working.
I did the usual thing like:
Controller:
$this->helpers = array('TinyMCE.TinyMCE');
View:
$this->TinyMCE->editor('simple');
But I don't know why it is not placing .js file(s) required by the tinymce, where as somewhere it is working.
also I tried putting the required script this way:-
$this->Html->script('/TinyMCE/js/tiny_mce/tiny_mce.js', array(
'inline' => false
));
OR
echo $this->Html->script('/TinyMCE/js/tiny_mce/tiny_mce.js', array(
'inline' => false
));
What should be the problem?
Reported by Guy Steels | March 3rd, 2011 @ 06:32 AM
It would be handy to add to the documentation of this plugin that you have to copy/clone it in a "tiny_mce" folder in the app/plugins folder. Otherwise you run into path issues. I had set it up as a git submodule in app/plugins/tinymce and it took me a while to figure out why it didn't work :)
Thanks for this great plugin btw.
sorry, wrong plugin
This is version for cakephp 3.x:
http://blog.sheetmusic4you.net/articles/view/2
Hi,
I tried to update the plugin at Tiny 3.5.8. I have download the new Tiny version from
http://www.tinymce.com/download/download.php
but i riceve the follow error:
GET http://blog:8888/TinyMCE/js/tiny_mce/tiny_mce.js 500 (Internal Server Error) 3:11
Uncaught ReferenceError: tinyMCE is not defined 3:15
(anonymous function)
Can you tell me how do I update tinymce?
Thank a lot
Hello Team,
Can you guide me to implement this plugin in cakePHP 3?
Thanks in advance.
The version of TinyMCE in HEAD of master (https://github.com/CakeDC/TinyMCE/tree/553db5b1248ec3c8df1636303e4b28b13997a8de) uses the jQuery version of TinyMCE, but the documentation does not state that requirement. Also, the Installation documentation incorrectly references the Migrations plugin.
echo $this->Html->script('/wysiwyg/js/tiny_mce/tiny_mce.js'); works in my layout but not in the helper. the file that is loaded by cake does not even make a cake error it makes an Apache error.
its possible this is a cake bug
i have a custom plugin dir set with app::build()
In CakePHP 2.6.3, I get the following error when trying to save my post in a form that uses the TinyMCE helper:
"Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'transform' at line 1"
I'm using XAMPP v1.8.3 as testing enviroment so PHP version should be 5.5.15.
Edit: Forgot to mention, the TinyMCE editor didn't load at all out of the box; I replaced it with TinyMCE 3.5.11 downloaded from tinymce.com to fix this. I don't know if this is related to my issue.
The path to TinyMCE has a default value in TinyMCEHelper.php which is set to '/TinyMCE/js/tiny_mce/tiny_mce.js'. It is not possibly to globally override this value and specify an alternative version of TinyMCE without having to pass additional settings to the helper during construction in the controller.
It would be nice to have a global setting that can be used to specify which version is used.
CakePHP seems to be loading the plugin because I'm not getting any errors when loading from bootstrap, including the helper in the control and then using it in the view, but nothing happens to my <textarea></textarea>
tags which I placed before and after the script in the view. I have also loaded jQuery. Any ideas on what might be wrong?
Controller:
public $helpers = ['TinyMCE.TinyMCE'];
View:
<textarea></textarea>$this->TinyMCE->editor(array('theme' => 'advanced'));
HTML (view source, when the page is loaded):
<textarea>
</textarea>
<script>
//<![CDATA[
tinymce.init({
script : "/TinyMCE/js/tiny_mce/tiny_mce.js",
load_script : "1",
theme : "advanced"
});
//]]>
</script>
<textarea>
</textarea>
Bootstrap:
Plugin::load('TinyMCE', ['autoload' => true]);
Configure::write('TinyMCE.configs', array(
'advanced' => array(
'mode' => 'textareas',
'theme' => 'advanced',
'plugins' => 'emotions,spellchecker,advhr,insertdatetime,preview',
'theme_advanced_buttons1' => 'newdocument,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,fontselect,fontsizeselect,formatselect',
'theme_advanced_buttons2' => 'cut,copy,paste,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,|,code,preview,|,forecolor,backcolor',
'theme_advanced_buttons3' => 'insertdate,inserttime,|,spellchecker,advhr,,removeformat,|,sub,sup,|,charmap,emotions',
'width' => '700',
'theme_advanced_toolbar_location' => 'top',
'theme_advanced_toolbar_align' => 'left',
'theme_advanced_statusbar_location' => 'bottom',
'theme_advanced_resizing' => 'true'
)
)
);
I also just noticed, when I pr($this->TinyMCE);
I get:
TinyMCE\View\Helper\TinyMCEHelper Object
(
[helpers] => Array
(
[0] => Html
)
[theme] =>
[plugin] =>
[fieldset] => Array
(
)
[tags] => Array
(
)
[implementedEvents] => Array
(
[View.beforeRender] => beforeRender
)
[_config] => Array
(
)
)
For some reason there is nothing in [theme] value, it should be - advanced. What am I doing wrong? Is something wrong with this line - $this->TinyMCE->editor(array('theme' => 'advanced'));
?
These are the steps that I am following after reading the docs. I am using Cake 3.3.x.
(1) Downloaded the master file of TinyMCE as a zip file.
(2) Extracted it to plugins/TinyMCE folder in my app. Now it has the following directory structure:
(2) Replaced it with the 3.x branch. in the same directory
(3) Typed: $this->Html->script('/TinyMCE/js/tiny_mce4/tinymce.min.js', ['block' => true]);
in the layout but doesnt load any javascript or display any error after or before I loaded jquery version 1.11.3.
(4) Since the above didn't work, I erased it and loaded the helper in the specific Controller where I wanted to use it (not the general AppController). Right after calling the class of the controller I wrote: public $helpers = ['TinyMCE.TinyMCE'];
(5) Tried loading in the view top the following: $this->TinyMCE->editor(['theme' => 'modern', 'selector' => 'textarea']);
gives the above error:
Error: TinyMCE.TinyMCEHelper could not be found.
Make sure your plugin TinyMCE is in the D:\wamp\www\testingapp\plugins\ directory and was loaded.
Error: Create the class TinyMCEHelper below in file: D:\wamp\www\testingapp\plugins\TinyMCE\src\View\Helper\TinyMCEHelper.php
<?php
namespace TinyMCE\View\Helper;
use Cake\View\Helper;
class TinyMCEHelper extends Helper
{
}
I followed the path shown in the error above, and the file TinyMCEHelper.php does exists with all the code inside. I am under wamp 3.0.4. with short tags off.
What am I missing here? Please help me.
Is there a way to debug this at all or to test and see why I am not getting the editor loading?
I have the following setup:
bootstrap.php
CakePlugin::load('TinyMCE');
DesignBlocksController.php
public $helpers = array('TinyMCE.TinyMCE');
DesignBlock - View add.ctp
$this->TinyMCE->editor(array('theme' => 'advanced', 'mode' => 'textareas'));
Nothing is loading at all.
I even tried adding the following into the add.ctp file but still nothing shows.
echo $this->Html->script('/TinyMCE/js/tiny_mce/tiny_mce.js', array('inline' => false));
Thanks
I checked within debug_kit and under the includes tab I am only getting two plugins loaded, not the third being TinyMCE.
The last 3 lines of my bootstrap file are:
CakePlugin::load('TinyMCE');
CakePlugin::load('DebugKit');
CakePlugin::load('Composer', array('bootstrap' => true));
TinyMCE won't load but DebugKit and Composer will.
I'm using cake 2.3.4. When using the plugin on my local machine (using WAMP) it works fine, however when I move my whole cake app to my intranet it fails to include the tiny_mce.js file.
I get this error in console.
GET http://intranet/knowledgebase/TinyMCE/js/tiny_mce/tiny_mce.js 500 (Internal Server Error).
The only difference is the ap is now running on intranet/knowledgebase rather than localhost/knowledgebase.
Can anyone point me in the right direction?
Thanks
I'm using Cake 2.2.1
My bootstrap.php loads the TinyMCE
My messages_controller adds to helpers = array('TinyMCE.TinyMCE');
My Messages edit.ctp view contains:
echo $this->Form->input('message_text');
$this->TinyMCE->editor(array('selector' => "textarea#MessageMessageText",
'theme' => 'simple',
'width' => '700px',
'mode' => 'textareas',
'height'=>'300px',
'editor_selector' => 'mceSimple',
'plugins' => "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking save table contextmenu directionality emoticons template paste textcolor",
'content_css' => "css/content.css",
'toolbar' => "insertfile undo redo | bold italic | alignleft aligncenter alignright | bullist numlist outdent indent | preview | forecolor backcolor emoticons"
)
);
ALL of which gets me a TinyMCE box showing html markup which just happens to have
text
in it.
Where should the plugin css be located? Seems that the css/content.css is not correct... but where should I have it installed. It is currently .. \app\Plugin\TinyMCE\webroot\js\tiny_mce\themes\simple\skins\default\content.css
Now if tinymce and javascript are set up to pull the themes from here, it's not! It seems that CakePHP way would like to have the css in \Plugin\TinyMCE\webroot\css, but then the theme option would have to be specified in the css url?
I'm at a loss to get things working.
I would point out that the textarea DOES have spellchecker working... so it's very close to being right!
Thank you all in advance for any assistance
Greg
The plugin works really great on my computer, but for some reason its shown 500 error when I uploaded online. is there anywway it can be solved?
http://www.canteloops.com/cantadmin/TinyMCE/js/tiny_mce/tiny_mce.js
Does not work in cakephp 3.2, I cant do it working. Missing Helper all the time and I followed doc. Thanks.
Hello,
I followed your instructions, and it shows up in but with wrong URL -
The following part seems to be incorrect -
$this->Html->script('/tiny_mce/js/tiny_mce/tiny_mce.js', array('inline' => false));
It tries to find the js at the following location -
http://cakephplocation/tiny_mce/js/tiny_mce/tiny_mce.js
Also, how do I assign this to an actual input() field - $this->TinyMCE->editor(array('theme' => 'advanced')); ?
I am using cakpehp 2.4.9 and I am trying to use this plugin, in the view file I can see that form is generated, with textfields beings replaced by tinymce, but the form is not submitting, I mean it doesn't do "POST". When I see in the console , I see this error
event.returnValue is deprecated. Please use the standard event.preventDefault() instead. tiny_mce.js:1
'KeyboardEvent.keyLocation' is deprecated. Please use 'KeyboardEvent.location' instead. tiny_mce.js:1
An invalid form control with name='data[Post][content]' is not focusable.
one thing to notice here is that when I don't use tinymce, the form is posting data just fine
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.