Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Make quote in editor read only

Hi Team,

We enabled quote plugin in our forum & noticed that the quoted element in wysiwyg editor is editable. We want it to be read-only. I tried using javascript & jquery & add .prop(contenteditable, false). We also tried .attr, did not work either. Do we have a quote orr editor config settings where we can set it to readonly?

TIA

Comments

  • There is no way. After all a quote is just markup.

    You would need to write an entirely new plugin which only saves a reference to the quoted post and that content would have to be included everytime the quote should be displayed.

    I don't see a gain for such an effort

  • Our use case is that when user quote a post (discussion/comment) and then have o edit the quoted post will create dirty/mismatch reference. For me, they should be able add text or other content, but the quoted part on the editor should be read only.

    Think I'll go with creating custom plugin. Thanks.

  • x00x00 MVP
    edited August 2018

    rethink the problem. You want replies.

    grep is your friend.

  • I see three nearly unsolvable problems
    1. UI while writing a comment/discussion that shows one or more posts
    2. Quoting only parts of comments
    3. Permissions for quotes of

  • BleistivtBleistivt Moderator
    edited August 2018

    @martin28 Users who forge quotes should be removed from the community anyway.

    But I'll use this opportunity to sneakily advertise my plugin here:
    https://open.vanillaforums.com/addon/quotemention-plugin

    This will display the last post by a mentioned user (in the same thread) in a tooltip, which can't be forged.

  • martin28martin28 New
    edited September 2018

    Not sure if you understood my case, maybe because of my english, my apology.

    Anyway, I registered permission to add & view only & set the config $Configuration['Plugins']['Quotes']['Editable'] = false, but still the quoted element in editor (wysiwyg) is still editable. Other forums have their quote readonly, that's what were trying to replicate.

    I found a protected function formatQuote() in class.quotes.plugin.php:

    blockquote class="Quote"
    div class="QuoteAuthor" $attribution /div
    div class="QuoteText" $quoteBody /div
    /blockquote

    *edited the html markup to make readable on this editor

    Adding contenteditable="false" in blockquote class makes all the quote readonly even on editor. But Im sure its wrong way of doing it. Do we have ways to hook into the plugin function?

  • x00x00 MVP
    edited September 2018

    This is obviously easy to get round if you know what you re doing.

    If you want this superficial protection then javascript is just as good. After all editor is using javascript anyway.

    Btw this is use case is kind of silly. If you are quoting the whole post you might as well just have replies.

    One of the advantages of a quote is you can cut it down, and reply to bit that is relevant and interleave your comments. You can also quote thing off site. If there is no trust in your community then a replies system would be better.

    Quoting long post just make a discussion tedious to read.

    grep is your friend.

Sign In or Register to comment.