Menu

#89 insertHtml

open
nobody
None
5
2008-02-05
2008-02-05
saul11
No

A very simple plugin for inserting one piece of preset HTML content.
Specify the HTML in the command InsertHtml on line 34 in 'fckplugin.js'.

Could be extended to be able to specify multiple HTML snippets and show a dialog to select one to insert... (Should you want this functionality and have a donation to spare, feel free to contact me)

Discussion

  • saul11

    saul11 - 2008-02-07

    Logged In: YES
    user_id=1371356
    Originator: YES

    File Added: insertHtml.zip

     
  • Alfonso Martinez

    Logged In: YES
    user_id=1356422
    Originator: NO

    Forgive me if I'm missing something, but your suggestion about multiple HTML snippets sounds just like the Templates command in the editor. And even there's another plugin that allows to insert any HTML, not restricted to any previous text.

     
  • saul11

    saul11 - 2008-02-11

    Logged In: YES
    user_id=1371356
    Originator: YES

    Ah indeed, the templates system could work here too. About the other plugin, not sure, does it popup a dialog to let you enter HTML or does it allow you to pick any of multiple predefined snippets?

    If my above assumption of the other plugin is correct, then I guess the simplicity of the inserHTML plugin remains to be its only strength: you can let your users easily insert HTML by clicking just a single button...

     
  • Alfonso Martinez

    Logged In: YES
    user_id=1356422
    Originator: NO

    The other plugin that I have in mind does present a dialog to enter the HTML to be introduced. As you say, if you want your users to enter just a fixed string then this plugin is a good example of how to do it, but I would have placed the string as a configuration item, not hardcoded inside the plugin.

     
  • saul11

    saul11 - 2008-02-12

    Logged In: YES
    user_id=1371356
    Originator: YES

    Indeed, as it now turns out to remain a 'single HTML snippet input button', this snippet would indeed be best configurable from out of the fckconfig file.

    UPDATE:
    This has been changed and the snippet you want to insert can be configured with the variable FCKConfig.insertHtml_snippet in your fckconfig.js.

    E.g.
    FCKConfig.Plugins.Add('insertHtml');
    FCKConfig.insertHtml_snippet = '<br /><div class="contentBlock"><div class="top">title</div><div class="bottom">text</div></div><br />';

    This plugin is now and will remain a 'Very simple plugin for inserting just one piece of preset HTML content.'
    File Added: insertHtml.zip

     
  • saul11

    saul11 - 2008-02-19

    Logged In: YES
    user_id=1371356
    Originator: YES

    Update:

    As there only one single configurable HTML snippet that can be inserted, the tooltip should describe this snippet and thus should be configurable too. That is now possible and the full code to add and configure the plugin in fckconfig.js is now:

    FCKConfig.Plugins.Add('insertHtml');
    FCKConfig.insertHtml_snippet = '<br /><div class="contentBlock"><div class="top">title</div><div class="bottom">text</div></div><br />';
    FCKConfig.insertHtml_tooltip = 'Whatever tooltip you want to appear, e.g. a description of the element being inserted';

    File Added: insertHtml.zip

     
  • Manne

    Manne - 2008-03-22

    Logged In: YES
    user_id=2042957
    Originator: NO

    A neat little plugin. How do I make sure that the html being inserted isn't stripped when saving the post? (I'm using Wordpress)

     
  • CrazyLexx

    CrazyLexx - 2008-05-05

    Logged In: YES
    user_id=2079743
    Originator: NO

    I'm having problems to even get this plugin to work: I have copied the insertHtml folder into editor/plugins on the server, copied those lines into fckconfig.js and even cleared my browser cache but the button simply won't show up in the editor's tool bar.

    Any hints as to what I might have done wrong?!

    TOM

     
  • saul11

    saul11 - 2008-05-15

    Logged In: YES
    user_id=1371356
    Originator: YES

    crazylexx, You'll have to add 'insertHtml' to the toolbar, see the docs http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Toolbar

    manne-1, try the Wordpress community for help

     
  • John Dolby

    John Dolby - 2008-10-24

    I keep getting an error when trying to download the code. Can you email it to me? mailto:john.dolby@casa.gov.au

     
  • saul11

    saul11 - 2009-01-30

    Update:
    I've added an option to choose between inserting just one snippet of pre-configured HTML or the ability to enter HTML into a dialog and have it inserted at the location of the cursor in the editor.
    The size of the textarea into which HTML can be inserted can be configured and the dialog will automatically adapt to this size. For all the configuration options see the included 'help.txt' file.

    File Added: insertHtml.zip

     
  • baijianpeng

    baijianpeng - 2009-04-26

    Can this plugin allow to insert also php code and JavaScript code?

    If can't, I suggest the author to add this feature. You can make a dropdown list above the textarea, then user can select HTML or php or JS, then paste their code into the textarea.

    Thanks.

     
  • Paulo H. Avelar

    Paulo H. Avelar - 2009-05-29

    I don't see a download button to get this plugin... how can I get it?

     
  • Paulo H. Avelar

    Paulo H. Avelar - 2009-05-29

    never mind... escrow down to the end of this page and there is an Attached file link...

     
  • uniterre

    uniterre - 2009-06-19

    I see that we can't edit a preexisting html after having selected a code

     
  • saul11

    saul11 - 2010-03-16

    Plugin Update:
    You can now also configure a list of snippets to provide to the user to choose from; or let him enter HTML manually. See the included help file for more information.

     
  • saul11

    saul11 - 2010-03-16

    insertHtml.zip

     
  • Anonymous

    Anonymous - 2010-05-09

    ~~~~
    $(".voce-secondaria2").hover (function() {
    $(this).addClass("menu_secondario_hover");
    },
    function () {
    $(this).removeClass("menu_secondario_hover");
    });
    ~~~~Hi saul11, a nice plugin this is. Though I'm missing something, if I would know more about Java I´d like to do it myself.... anyway, I'd like to have the option to defineseveral freetextoptions in a snippet. E.g

    [code]
    'TextToggle': '<h2 class="trigger"><a href="#">FreeTEXT Header</a></h2><div class="toggle_container"><div class="block"><h3> optional Freetext Content Header</h3> Freetext</div></div>',

    [/code]

    So for the fields FreetTEXT header, optional Content HEader and Freetext I would like to have a own Freetext field inside the insetHTML module when opening this particular snippet.

    All of what I'm asking here does also work directly from inside FCK but is a lot of hassle, especially when starting to edit the design.

    Feel free to contact me for anything.

    With best regards,

    J

     

    Last edit: Anonymous 2016-02-16

Log in to post a comment.

MongoDB Logo MongoDB