Try our conversational search powered by Generative AI!

How do I stop ampersand replacing with &

Vote:
 

Here am trying to embedd youtube video in some page using tiny mce editor and url contians & symbols.

when i publish the page and view in browser the & is replacing with & symbols. its bracking our functionality.

i dont want to replace & with &.

#221604
Edited, Apr 22, 2020 6:57
Vote:
 

Hi,

I think you can try changing the entity_encoding to raw

entity_encoding : "raw"


Try can you please try this-

[ModuleDependency(typeof(TinyMceInitialization))]
    public class ExtendedTinyMceInitialization : IConfigurableModule
    {
        public void Initialize(InitializationEngine context)
        {
        }

        public void Uninitialize(InitializationEngine context)
        {
        }

        public void ConfigureContainer(ServiceConfigurationContext context)
        {
            context.Services.Configure<TinyMceConfiguration>(config =>
            {
                // Add content CSS to the default settings.
                config.Default()
                    .ContentCss("/static/css/editor.css")
                    // global config to use numeric encoding, see last line if you only need
                    // it for one property on a type
                    .AddSetting("entity_encoding", "raw");

                // add settings to tinymce
                config.Default()
                    .AddPlugin("code charmap")
                    .AppendToolbar("code charmap");

                // OR use numeric encoding only for a specific types field
                config.For<StandardPage>(t => t.SpecialField).AddSetting("entity_encoding", "raw");
            });
        }
    }
}
#221606
Apr 22, 2020 7:39
Vote:
 

Hi Ravindra,

Thanks for your reply. here my editior is in block. when i apply this one entity_encoding : "raw"  , am facing problems for other options. 

like its not displaying code icon and other icons.

.image  u can see the image here

https://drive.google.com/open?id=1ZifTJnh8gmIQoXx3J7rLlNvwFvIXTiae

here is my code

context.Services.Configure<TinyMceConfiguration>(config =>
{
config.Default()
.AddSetting("valid_children", "+body[style]").AddSetting("extended_valid_elements", "script[language|type|src]").AddSetting("extended_valid_elements", "select[onchange|class|id],a[class|id|aria-label|href|name|rel|rev|urn|title|target|methods|hreflang|media|shape|type|class],div[data-experience]")
.RawSettings(customSettings);
config.For<EditorBlock>(t => t.MainBody).AddSetting("entity_encoding", "raw");
}
);

#221636
Edited, Apr 22, 2020 16:04
Vote:
 

You can add them by .AddPlugin("code other buttons") method. 

#221638
Edited, Apr 22, 2020 16:10
Vote:
 

One more thing did the encoding resolved your "&amp;" issue?

#221677
Apr 23, 2020 6:34
sandeep vemula - Apr 23, 2020 11:03
not resolved
Vote:
 

Hi Ravindra,

its not working.

i modified like below both scenarios.

context.Services.Configure<TinyMceConfiguration>(config =>
config.Default()
.AddSetting("valid_children", "+body[style]").AddSetting("extended_valid_elements", "script[language|type|src]").AddSetting("extended_valid_elements", "select[onchange|class|id],a[class|id|aria-label|href|name|rel|rev|urn|title|target|methods|hreflang|media|shape|type|class],div[data-experience]")
.RawSettings(customSettings)
.AddPlugin("entity_encoding", "raw")
);

or

if i use below code code icon is not displaying in this block to insert URL.

context.Services.Configure<TinyMceConfiguration>(config =>
config.For<EditorialBlock>(t => t.MainBody).AddSetting("entity_encoding", "raw")
.AddSetting("valid_children", "+body[style]").AddSetting("extended_valid_elements", "script[language|type|src]").AddSetting("extended_valid_elements", "select[onchange|class|id],a[class|id|aria-label|href|name|rel|rev|urn|title|target|methods|hreflang|media|shape|type|class],div[data-experience]")
.RawSettings(customSettings)
.AddPlugin("entity_encoding", "raw")
);

#221689
Edited, Apr 23, 2020 8:59
Vote:
 

Hi Ravindra, Can you please help to resolve this issue.

#221761
Apr 24, 2020 10:21
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.