Using copy-paste (or the code plugin) users are able to insert content including spans yielding to nested spans even though i thought that my settings forbid nested spans. I do want to have nested spans been filtered out when the "cleanup" action gets performed.
Doing a manual cleanup (command "mceCleanup" which is triggered after pasting text) does not help either.
Reffering to the TinyMCE documentation a user may choose which child elements tinymce discards when performing "cleanup" for defined parent nodes.
Is there a problem with my config? If yes, what is wrong?
Any suggestions?
Here's my configuration (the relevant part, i am using the newest tinymce version (3.3.8), occurs in all major browsers):
cleanup : true,
encoding: "xml",
dialog_type : "modal",
object_resizing: false,
paste_strip_class_attributes: "all",
entity_encoding: "raw",
fix_nesting: true,
invalid_elements: "strong,ul,ol,li",
// The valid_elements option defines which elements will remain in the edited text when the editor saves.
valid_elements: "#[id|class|title|style],"
+ "a[name|href|target|title],"
+ "#p,-ol,-ul,-li,br,img[src],-sub,-sup,-b,-i,"
+ "-span,hr",
valid_child_elements : "body[p|ol|ul]" //EDIT: had some ","s instead of "|"s
+ ",p[a|span|b|i|sup|sub|img|hr|#text]"
+ ",span[a|b|i|sup|sub|img|#text]"
+ ",a[span|b|i|sup|sub|img|#text]"
+ ",b[span|a|i|sup|sub|img|#text]"
+ ",i[span|a|b|sup|sub|img|#text]"
+ ",sup[span|a|i|b|sub|img|#text]"
+ ",sub[span|a|i|b|sup|img|#text]"
+ ",li[span|a|b|i|sup|sub|img|ol|ul|#text]"
+ ",ol[li]"
+ ",ul[li]"
I don't think there is any problem with your config.
The problem is that the TinyMCE code totally ignores the valid_child_elements attribute since version 3.3b1 (25 January 2010). I used Window Grep to examine all files in the 3.3.8 download and the valid_child_elements string is only found twice (and on the same line) in /jscripts/tiny_mce/Classes/Editor.js - this turns out to be a simple assignment statement that is not used anywhere else.
It turns out that in version 3.2.7 (22 September 2009) or below (see http://sourceforge.net/projects/tinymce/files), the valid_child_elements attribute calls a function called addValidChildRules in /jscripts/tiny_mce/Classes/dom/Serializer.js which I believe does what you essentially want. There are bugs in this version mind you. I eventually got the nested tags to be removed after adding a simplified valid_child_elements config parameter to one of the sample files in the download:
valid_child_elements : "span[a|b|i|sup|sub|img|#text]"
Hope this helps.
Related
I inherited an old TYPO3 Extension using SOBE. As far as I unterstand it's deprecated, but it seems there is no documentation on how to replace it.
The Extension is using Backend Forms and the following line is throwing an error:
if (is_array($GLOBALS['SOBE']->editconf['tt_content']) && reset($GLOBALS['SOBE']->editconf['tt_content']) === 'new') {
The error is:
Cannot access protected property TYPO3\CMS\Backend\Controller\EditDocumentController::$editconf
The Var $GLOBALS['SOBE'] is still there, and there is also editconf, but it's not working.
How can I replace this code or rewrite it?
The SOBE object is part by part removed since years. As there are multiple ways for using it - see https://docs.typo3.org/c/typo3/cms-core/main/en-us/search.html?q=sobe&check_keywords=yes&area=default - you may need to take a closer look what is the exact part of replacing this code.
I would guess you can see more at https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/9.2/Deprecation-84195-ProtectedMethodsAndPropertiesInEditDocumentController.html?highlight=editconf.
I replaced the usage of this class with JRHtmlExporter to HtmlExporter.
When I build my java file i got below error cannot find symbol IS_USING_IMAGES_TO_ALIGN
MY CODE IS:
exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, new Boolean("false"));
What is equivalent function?
You need to remove this setting since it's not supported anymore (it's false by default), for more information see:
How to set IS_USING_IMAGES_TO_ALIGN in HtmlExporter in Java ? by lucianc staff of jasper-reports
The new HtmlExporter does not support using images for alignment. So you no longer need to set IS_USING_IMAGES_TO_ALIGN to false, it is false by default.
I've written a program in C using ncurses and specially forms. I need that a particular field of my form moves as I'm filling the form. I tried move_field, but it doesn't work.
Here is how I wrote it :
if (typact==ADSD && rowc>rowg )
{
move_field(field[ietg],rowg=rowc,colg);
refresh();
}
I'm sure that the move_field is executed (I use xCode for debugging my program). I presume that refresh is not sufficient. I tried also placing move_field between unpost_form and post_form like this:
if (typact==ADSD && rowc>rowg /* && !field_status(field[ietg]) */ )
{ unpost_form(my_form);
move_field(field[ietg],rowg=rowc,colg);
post_form(my_form); refresh();
}
but it doesn't work once again. The form is erased and re-posted without the texts I have written and the field is always in the same place.
How could I use move_field?
The manual page says
The function move_field moves the given field (which must be disconnected) to a specified location on the screen.
You can disconnect a field by retrieving the current list of fields with form_fields (and its length using field_count), removing the field from that list and updating the list using set_form_fields.
When using move_field, you must also (temporarily) unpost the form with unpost_form. Otherwise, move_field returns E_POSTED (The form is already posted). After moving the field, use post_form to get the form-driver to work with the updated form.
The test/move_field.c file in ncurses sources provides an example of these calls.
I get a project that used TYPO3 CMS, the task is quite simple, adding cookie usage notice on the header part of the website.
I never working on TYPO3 before, but already reading the documentation. Somehow I can't figure out which file to edit. even the documentation tutorial and file structure is different than the project I handle.
I don't have any project documentation for the project either, and I don't want to ask you to do my task, but I'm blank at the moment and don't know where to find the respective file needed.
Any suggestion or clue how to handle the issue?
my index.php on root folder look like this:
if (defined('E_DEPRECATED')) {
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
} else {
error_reporting(E_ALL ^ E_NOTICE);
}
// ******************
// Constants defined
// ******************
define('PATH_thisScript', str_replace('//', '/', str_replace('\\', '/',
(PHP_SAPI == 'fpm-fcgi' || PHP_SAPI == 'cgi' || PHP_SAPI == 'isapi' || PHP_SAPI == 'cgi-fcgi') &&
($_SERVER['ORIG_PATH_TRANSLATED'] ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED']) ?
($_SERVER['ORIG_PATH_TRANSLATED'] ? $_SERVER['ORIG_PATH_TRANSLATED'] : $_SERVER['PATH_TRANSLATED']) :
($_SERVER['ORIG_SCRIPT_FILENAME'] ? $_SERVER['ORIG_SCRIPT_FILENAME'] : $_SERVER['SCRIPT_FILENAME']))));
define('PATH_site', dirname(PATH_thisScript).'/');
if (#is_dir(PATH_site.'typo3/sysext/cms/tslib/')) {
define('PATH_tslib', PATH_site.'typo3/sysext/cms/tslib/');
} elseif (#is_dir(PATH_site.'tslib/')) {
define('PATH_tslib', PATH_site.'tslib/');
} else {
// define path to tslib/ here:
$configured_tslib_path = '';
// example:
// $configured_tslib_path = '/var/www/mysite/typo3/sysext/cms/tslib/';
define('PATH_tslib', $configured_tslib_path);
}
if (PATH_tslib=='') {
die('Cannot find tslib/. Please set path by defining $configured_tslib_path in ' . htmlspecialchars(basename(PATH_thisScript)) . '.');
}
// ******************
// include TSFE
// ******************
require (PATH_tslib.'index_ts.php');
edit: adding screenshot of the interface suggested by #Riccardo (typo3 ver 4.4.4)
Which version of TYPO3 are you running? As Bernd wrote, it is difficult to help you without further information.... I'll try to explain the first passages where you could gather some infos.
1) Access TYPO3 backend with a user with administrative privileges
2) Try to identify the main TypoScript template with this procedure:
click on template (1)
click on the "zero" page with the TYPO3 symbol (2)
you should see on the right a list of the TypoScript templates (3),
click on the one that is marked as "is Root"
2) After that, click on the first dropdown on the right area (with the "info/modify" item and select "TypoScript Object Browser" (a.k.a. TSOB)
3) After you have done that, you should see a "tree" that represents the TypoScript configuration;
be sure to have "setup" selected (1)
search for the object that builds your page, which should most likely be page = PAGE (2)
[answer edited]
I'm afraid I'll have to ask for a survey supplement
Can you identify in which part of the various objects the header of your site is rendered? My suspects would be focused on the [home2] or the [outer_frameset] object;
Hoping that they will contain the usual array with something like:
home2.10 = something
I think that the quickiest (and dirtiest) way to append something before the whole page would be something like
home2.1 = TEXT
home2.1.value = <div>whatever your message would be </div>
I don't know if you need something more complex than that...
Said that, I admit I never worked with frame inside TYPO3 and I think that the last time I did something with frames was...uh... maybe 9 years ago.
Don't change that index.php!!
As it is part of the core which gets overwritten on an update of TYPO3.
As there are very much options for configurating a page there can be no recipe matching all.
My best tip: get a TYPO3 profi to have a look into your installation so he can find which files are responsible for the page rendering and could include the cookie notice.
There also are some extensions which could render such a notice in your pages in a very easy way. But that all depends how your installation is configured. Nothing to say without further knowledge.
I have written cucumber test scenario's that are tested with webkit and a firefox driver. In firefox the tests all pass, but with webkit one of them fails with error
Element at 40 no longer present in the DOM (Capybara::Webkit::NodeNotAttachedError)
/home/r/project/share/support/actions.rb:64:in `block (2 levels) in follow_link_in_new_tab'
/home/r/project/duplo/share/support/actions.rb:10:in `with_scope'................
This happens during the execution of a routine that is triggered by test step 'When I follow "Linkname". Strangely enough, most of the times this code works perfect, but in one case I get this 'no longer present error'.
The routine performs this:
res = find( 'a', text: text, visible: true)
if ((res[:target] || '') == '_blank')
#win = window_opened_by { res.click }
else
res.click
end
I found out that if I change this to
find( 'a', text: text, visible: true).click
the message disappears and the scenario passes the test. Who can help me understanding what can be the problem here. Why is this failing when the find result is assigned to a variable and why is it only failing in only few situations?
I use ruby 2.4.0 and capybara-webkit 1.2.0
thanks, Ruud
You don't indicate exactly which line is generating the error (which one is line 64), however the error indicates that you're still using an element after it has been removed from the page, either by JS deleting the element or a new page being loaded.
Additionally the visible: true option really shouldn't be needed since that is normally the default value for the visible option (unless you've changed it which is a terrible idea when testing software, not as bad if just scraping sites)
Also - capybara-webkit 1.2.0 was released in July 2014 -- You REALLY want to update that to the latest release if you're testing anything even slightly modern, as well as probably updating your ruby to at least the latest 2.4.x release.