-
AuthorPosts
-
March 29, 2015 at 1:37 am #419941
In advanced editor I paste in HTML which is well formated and has
blocks that are properly escaped as shown below, but as soon as the is saved and the escaped HTML does not remain escaped. Tried to use RAW plugin to resolve but [raw][/raw] does not work either. How DO I FIX THIS!!!! <p>Add the following lines:</p> <div>
<?xml version="1.0" encoding="utf-8"?> <Profile Type="0" DisplayName="TIFF 200dpi Optimized Color" Description ="Word Printed 2-Up with Comments and Date Replacement."> </Profile>
</div>
March 30, 2015 at 10:06 am #420301Hi peernet!
Could you provide us with a link to the site in question so that we can take a closer look please?
Cheers!
RikardMarch 30, 2015 at 2:20 pm #420425Rikard,
Sites internal but this is what I have figured out so far.
I had to switch to Advanced Layout to add an Advanced LayerSlider so it was full width header but I would have preferred to just have an two Layout settings added just like you do for sidebar settings on each page/post. One for:
LayeredSlider Heading
LayeredSlider FootingOr even just some shortcode code you can add to the Heading and Footing that are full width, so we did not have to switch to Advanced Layout.
Anyways: If you create a text code or code block with the following, after you update the escaped HTML is removed.
- Stop Watch Folder Service. (Start – Programs – PEERNET Document Conversion Service 2.0 – Watch Folder – Stop Watch Folder Service)
- Open Watch Folder configuration file. (Start – Programs – PEERNET Document Conversion Service 2.0 – Watch Folder – Configure Watch Folder Settings)
- Add the following lines:
- <add Name=”Microsoft.Word.Document.PrintOut.Item” Value=”DocumentAndMarkup” />
- <add Name=”Microsoft.Word.PageSetup.TwoPagesOnOne” Value=”True” />
- <add Name=”Microsoft.Word.ReplaceFieldDateWith” Value=”***DATE***” />
- For a complete list of settings and values, see Word Converter Options in the User Guide.
What I found out this morning is If you put a space between the ‘<add’ and code it as ‘< add’ as shown below. Then in at least text block, the HTML remains escaped but why (did not test code block yet)?
- Stop Watch Folder Service. (Start – Programs – PEERNET Document Conversion Service 2.0 – Watch Folder – Stop Watch Folder Service)
- Open Watch Folder configuration file. (Start – Programs – PEERNET Document Conversion Service 2.0 – Watch Folder – Configure Watch Folder Settings)
- Add the following lines:
- < add Name=”Microsoft.Word.Document.PrintOut.Item” Value=”DocumentAndMarkup” />
- < add Name=”Microsoft.Word.PageSetup.TwoPagesOnOne” Value=”True” />
- < add Name=”Microsoft.Word.ReplaceFieldDateWith” Value=”***DATE***” />
- For a complete list of settings and values, see Word Converter Options in the User Guide.
So it appears the < needs a space following it to keep it escaped. But why?????
March 30, 2015 at 2:53 pm #420464I tested code block but it unescapes the html no matter what. So as soon as I switch to Advanced Layout to add the slider I am now in a position of not being able to create my pages/posts. It just unsable.
Is there any way to keep the default editor and get the advanced slider in the header with switch to this special layout environment?
Also, once I switch to Advanced Layout the post navigation is lost. Why did that happen?
March 30, 2015 at 3:00 pm #420476Also, do not understand why a Code Block in advanced layout is doing anything to the HTML/CSS/Javascript. It should just be a raw dump of what is inside the element but it keeps parse it and not treat it as a RAW element.
I need it to be RAW!!!!
March 30, 2015 at 3:22 pm #420500The post navigation is lost when you add an Advanced LayerdSlider. I orginally thought it was just switching to Advanced Layout but you need to add the LayeredSlider and then there is no more post navigation.
March 30, 2015 at 4:20 pm #420560I did figure out how to enable the post navigation by overriding avia_post_nav in my child theme and commenting out:
//dont display if a fullscreen slider is available since they overlap
// if((class_exists(‘avia_sc_layerslider’) && !empty(avia_sc_layerslider::$slide_count)) ||
// class_exists(‘avia_sc_slider_full’) && !empty(avia_sc_slider_full::$slide_count) ) $settings[‘is_fullwidth’] = true;March 30, 2015 at 5:10 pm #420607If you are careful and just add a codeblock and paste in the escaped HTML and then do an update immediately
then the displayed page is correct.On the edit page view the content of the div:
<div id=”wp-content-editor-container” class=”wp-editor-container”><textarea class=”wp-editor-area” style=”height:
300px” autocomplete=”off” cols=”40″ name=”content” id=”content”>Is correct with the escaped code block properly escaped twice as expected.
The AJAX request back to load up the editor layout parts is wrong. On the post data the ‘content’ has been unescaped twice instead of once which leads to the issue.
I just have not figured out where in the Javascript/HTML the post back is made to the text_to_interface function in the template-builder.class.php
Hopefully, I will find out where soon so I can repair it.
March 30, 2015 at 5:34 pm #420630This following code is wrong!!!!!
/**
* takes some text in shortcode format (eg: [avia_textblock]this is test[/avia_textblock]) and converts it to an editable element on
* the AviaBuilder canvas. only executed at page load or when the editor is switched from default wordpress to avia builder
*/
convertTextToInterface: function(text)
{
if(this.activeStatus.val() != “active”) return;this.body_container.addClass(‘avia-advanced-editor-enabled’);
var obj = this, editor;
if(typeof text == “undefined”)
{
text = this.secureContent.val(); //testdrive: val() to html()
if(text.indexOf(‘[‘) === -1)
{
text = this.classic_textarea.val(); //testdrive: val() to html()
if(this.tiny_active) text = window.switchEditors._wp_Nop(text);
this.secureContent.val(text);
}
}// if(this.tiny_active) text = window.switchEditors._wp_Nop(text); // moved up 5 lines in order to fix this: https://github.com/AviaThemes/wp-themes/issues/573
//sends the request. calls the the wp_ajax_avia_ajax_fetch_shortcode php function
$.ajax({
type: “POST”,
url: ajaxurl,
data:
{
action: ‘avia_ajax_text_to_interface’,
text: text
},
success: function(response)
{
$(‘#content-tmce’).trigger(‘click’);
obj.sendToAdvancedEditor(response);
//obj.updateTextarea(); //dont update textarea on load, only when elements got edited
obj.canvas.removeClass(‘preloading’);
obj.do_history_snapshot();
}
});—————————–
The line:
text = this.secureContent.val(); //testdrive: val() to html()Should be:
text = this.secureContent.html(); //testdrive: val() to html()I can see many val() to html() testdrive comments, but for sure this needs to be in html format for the POST operation.
March 30, 2015 at 6:29 pm #420696Okay, I am wrong about the changing it to html()
What really is going on is _aviaLayoutBuilderCleanData which contains the correct html content is being transformed incorrectly by val() and html().
If you call val() then all escaped HTML is lost. It not the content of the _aviaLayoutBuilderCleanData element, it’s altered.
if you call html() same thing as doing val() call and then doing EncodeElements $(“<div/>”).text(text).html().What you really want it the exact content held by the _aviaLayoutBuilderCleanData element.
I tracked down this article which highlights the issue:
http://stackoverflow.com/questions/16252931/getting-inner-html-without-escaping-or-decoding-anything-with-jquerySo I can see now that the content of the _aviaLayoutBuilderCleanData element although if you view the source of the page had the right content when you call val() or html() you will never get the orginal html.
The _aviaLayoutBuilderCleanData element needed to be in escaped format so if is raw data. You don’t want the browsers altering this information behind the scene which is what is happening now.
I’ll continue working on this to see if I can come up with a proper fix.
March 31, 2015 at 8:55 am #420994Hi!
It’s difficult for us to see what’s going wrong if you’re on a local installation, could you please upload something to a live server so that we can have a look for ourselves?
Regards,
RikardMarch 31, 2015 at 1:43 pm #421096I understand you are looking for us to give you live access but it is not environmental.
I know it has to do with any escaped html in a codeblock or a textblock.
I can see the issue in the debugger php and javascript debugger. I just do not sure which side is a fault yet.
Basically, for codeblock the contents are interpreted somewhere along the way causing the escaped html to be lost (unescaped).
You can do this yourself by simply entering the following code in a codeblock. I assume you have access to enfold theme (press update and you will see the error).
<div style="margin-left: 15px; line-height: 15px; font-size: 12px; font-family: courier; background-color: #e2e2e2; padding-left: 5px;"> <pre><code><?xml version="1.0" encoding="utf-8"?> <Profile Type="0" DisplayName="TIFF 200dpi Optimized Color" Description ="Word Printed 2-Up with Comments and Date Replacement."> <Settings> <span style="background-color: yellow;"><strong><!--Word Specific options --></strong></span> <span style="background-color: yellow;"><strong><add Name="Microsoft.Word.Document.PrintOut.Item" Value="DocumentAndMarkup"/></strong></span> <span style="background-color: yellow;"><strong><add Name="Microsoft.Word.PageSetup.TwoPagesOnOne" Value="True"/></strong></span> <span style="background-color: yellow;"><strong><add Name="Microsoft.Word.ReplaceFieldDateWith" Value="***DATE***"/></strong></span> <!-- Output file options --> <add Name="Devmode settings;Resolution" Value="200"/> <add Name="Save;Output File Format" Value="TIFF Multipaged"/> <add Name="Save;Append" Value="0"/> <add Name="Save;Color reduction" Value="Optimal"/> <add Name="Save;Dithering method" Value="Halftone"/> <!-- TIFF Compression Options --> <add Name="TIFF File Format;BW compression" Value="Group4"/> <add Name="TIFF File Format;Color compression" Value="LZW RGB"/> <add Name="TIFF File Format;Indexed compression" Value="LZW"/> <add Name="TIFF File Format;Greyscale compression" Value="LZW"/> <add Name="JPEG File Format;Color compression" Value="Medium Quality"/> <add Name="JPEG File Format;Greyscale compression" Value="High Quality"/> <add Name="Image Options;Fax" Value="0"/> </Settings> </Profile></code></pre> </div>
April 1, 2015 at 12:31 am #421673I know that the issue is around the fact certain elements are not htmlentities when html stream is created for the advanced editor.
I did get it to work somewhat correctly but there is no clear documentation about the config-templatebuilder library so it’s hard to get all the paths correct.
So even though I could correctly get textblock and codeblock to work. When saving sometimes one or two of these entities would be encoded wrong leading to loss of information again.
So basiclly, I can not use config-templatebuilder (Advanced Layout) tool. It’s just does not function properly.
So I am no longer going to use this part of Enfold. Only editor that works properly is the Classic Editor!!!!!
April 2, 2015 at 8:45 am #422339Hey!
Sorry if you’re having difficulty with the code block element but claiming that the advance layout editor doesn’t work because you can’t make a single element behave the way you want it to seems to be a little too far-fetched. You can add this to the codeblock content:
<?xml version="1.0" encoding="utf-8"?> <Profile Type="0" DisplayName="TIFF 200dpi Optimized Color" Description ="Word Printed 2-Up with Comments and Date Replacement."> <Settings> <span style="background-color: yellow;"><strong><!--Word Specific options --></strong></span> <span style="background-color: yellow;"><strong><add Name="Microsoft.Word.Document.PrintOut.Item" Value="DocumentAndMarkup"></add></strong></span> <span style="background-color: yellow;"><strong><add Name="Microsoft.Word.PageSetup.TwoPagesOnOne" Value="True"></add></strong></span> <span style="background-color: yellow;"><strong><add Name="Microsoft.Word.ReplaceFieldDateWith" Value="***DATE***"></add></strong></span> <!-- Output file options --> <add Name="Devmode settings;Resolution" Value="200"></add> <add Name="Save;Output File Format" Value="TIFF Multipaged"></add> <add Name="Save;Append" Value="0"></add> <add Name="Save;Color reduction" Value="Optimal"></add> <add Name="Save;Dithering method" Value="Halftone"></add> <!-- TIFF Compression Options --> <add Name="TIFF File Format;BW compression" Value="Group4"></add> <add Name="TIFF File Format;Color compression" Value="LZW RGB"></add> <add Name="TIFF File Format;Indexed compression" Value="LZW"></add> <add Name="TIFF File Format;Greyscale compression" Value="LZW"></add> <add Name="JPEG File Format;Color compression" Value="Medium Quality"></add> <add Name="JPEG File Format;Greyscale compression" Value="High Quality"></add> <add Name="Image Options;Fax" Value="0"></add> </Settings> </Profile>
We removed the wrappers like div, code and pre tags. Add the pre or code tag inside the Code Wrapper Element without the < and >. You can add additional attributes like class, style in the Code Wrapper Element Attributes elements field.
Regards,
IsmaelApril 2, 2015 at 1:59 pm #422468Yes, I did wrap the code in sperate blocks and can get it to partly work but then I lose my spans that highlight elements in the code block.
The fact is the architecture of the component editors are wrong. If you had followed the technique the tinyMCE used it would have worked but the fact is this component does not.
The tinyMCE encodes the data in htmlentities format from the server side so that escaped html is not interpreted by the browser when embedded in the textarea.
The templatebuilder does not and this is where everything starts to break down.
I as said: I started to fix this issue properly but ran into two issues when testing. The tab/editor protocol is different in some way from the textcode/codeblock to editor functionality so did not operate correctly. And on save, still was getting random lose of information on some elements but this in my lack of understanding the save process and probably could have figuire it out in another day.
The fact remains, any escaped html will not remain intact because the browsers are transforming them back to unescaped format.
I agree that you can use it if you stick to just plain HTML and do not do anything fancy. But I expected more.
April 4, 2015 at 6:29 am #423361Hey!
Looks like you know this stuff better than we do. You can request for these improvements on our feature request page, please kindly share information or pointers on how we can improve the element for future updates. Unfortunately, for now, you will have to make do of any workaround that you can come up with.
Regards,
IsmaelApril 4, 2015 at 6:01 pm #423475If I do go ahead an make improvements, how do I share the code changes back to you?
April 6, 2015 at 6:53 pm #424131 -
AuthorPosts
- You must be logged in to reply to this topic.