remove preview button

edited September 2014 in Modules
how to disable preview button in markitup textarea? the preview did not render correctly in global layout

Comments

  • edited September 2014
    Found one way. Not too pretty but it works.

    Go to \fuel\modules\fuel\assets\js\fuel\custom_fields.js

    There's a method called createPreview. You'll see the following around line 318 (I'm using v1.1).

    var createPreview = function(id){ var $textarea = $('#' + id); var previewButton = '<a href="#" ....

    Set 'previewButton' to be null in the code above, and it'll not be displayed.

    Edit: Alternatively, there's a CSS solution.

    In file \fuel\modules\fuel\assets\css\fuel.min.css, you'll see minified CSS that's used in the CMS.

    On the second line add the following:
    a.editor_preview { display: none; }
  • edited 4:33PM
    I've pushed an update to the develop branch where you can set the "preview" => FALSE. In addition, you can fix the rendering by specifying a different view file also using the "preview" parameter. The following example would look for a file in the fuel/application/views/fuel_preview:
    .... 'preview' => 'fuel_preview'...
    Alternatively, you can change the code in the fuel/application/views/_admin/_fuel_preview.php file.
  • edited 4:33PM
    Thanks guys
  • edited 4:33PM
    Actually if it could, I hope there is a preview button beside save which could preview whole form input instead of previewing text area input only Could u point me a direction, maybe I could try to write this as plugin to further my understanding of fuel cms. I believe this will be useful
  • edited 4:33PM
    That sounds like the "preview_path" parameter for your module. If you set that, a "View" button will appear. The "preview_path" should be the URI path to the page and include placeholders for form values like:
    ... 'preview_path' => 'news/{slug}' ...
  • edited 4:33PM
    i think the preview_path is only for saved data then use it for viewing?
  • edited 4:33PM
    That's correct, in that it needs to be saved. We are looking into the best way to do "drafts" but not sure when that feature will be implemented.
  • edited 4:33PM
    Hi!
    I want to make preview for some textareas with different styles, unfortunately option
    .. 'preview' => 'fuel_preview' ..
    does nothing, it still uses preview file in views/_admin/_fuel_preview.php,
    I tried to set different options (even empty value or not existing file) but it doesn't change a thing...
    (version 1.2.1)
  • edited 4:33PM
    It's not really stated in the documentation but the view file should be in the views/_admin/ folder. If you look at the fuel/modules/fuel/controllers/preview.php file, you'll see the logic of how it determines which view to use. Additionally, the variables 'module' and field are passed to the view file so it's possible to use a single view file with conditional logic to output different things based on those values.
  • edited 4:33PM
    That 'preview'=>false feature is handy. I couldn't find it documented in http://docs.getfuelcms.com/general/forms#wysiwyg though.

    It would be handy to have the 'source'=>false option too to hide the "source" button (in my CKEditor implementations, I use the built-in source edit feature)
Sign In or Register to comment.