In TinyMCE, can ChangeElementType change a P tag to a CODE tag?

Vote:
 

I have this CSS for TinyMCE:

code.csharp {
   EditMenuTitle: Code Styles;
   EditMenuName: C#;
   ChangeElementType: true;
}

    

The ChangeElementType should change a P to a CODE tag upon application.  However, it does not.  When in a P tag, applying the style does nothing.  If I change the selector to "H1.csharp", however, it does work, so I know the syntax is right.

Shouldn't TinyMCE change the P to a CODE (which is a block-level element)?

#64039
Dec 08, 2012 0:42
Vote:
 

I just checked, and it works with PRE -- it will change a P tag to a PRE tag.

#64040
Dec 08, 2012 0:56
Vote:
 

if your looking to use a syntax highlighting Deane, you will probably want it to be a pre tag anyway.  Pre works for me and since code is not in the allowed tags, i don't think it can work.  you can try to add the code tag in the tinymceplugin and see if it works.

[TinyMCEPluginNonVisual(AlwaysEnabled = true,
        PlugInName = "CustomEditorSettings",
        DisplayName = "Init options",
        Description = "Custom editor init options.",
        EditorInitConfigurationOptions = @"{
            paste_auto_cleanup_on_paste : true,
            theme_advanced_blockformats : ""h3,h4,h5,h6,p"",
            theme_advanced_styles : ""Auto Caption=auto-caption; Align Left=alignleft; Align Right=alignright"",
            theme_advanced_resizing : true,
            extended_valid_elements: ""ol[id|class|lang|dir|title|style|onclick|ondbclick|start|type],li[id|class|style|type],ul[id|class|style|type|onclick],code"" }")]
    public class CustomizeEditor { }

    

#64042
Dec 08, 2012 5:11