Quote selection (OD-1948)
wojtek opened 2 years ago

It would be nice to be able to only quote selected parts of the message. Right now, even if we select a part of the text and click on "quote", whole comment is inserted.

  • Robin Shen changed state to 'Closed' 1 year ago
    Previous Value Current Value
    Open
    Closed
  • Robin Shen commented 1 year ago

    This seems a bit complicated. Suggest to just copy text and paste

  • wojtek commented 1 year ago

    This seems a bit complicated. Suggest to just copy text and paste

    Could you elaborate? Limitation of Wicket that doesn't have anything akin to window.getSelection()?

    It's handled in io/onedev/server/web/component/comment/CommentPanel.java:194:

    viewer.add(new AjaxLink<Void>("quote") {
    
    	@Override
    	public void onClick(AjaxRequestTarget target) {
    		send(getPage(), Broadcast.BREADTH, new ContentQuoted(target, getComment()));
    	}
    
    	@Override
    	protected void onConfigure() {
    		super.onConfigure();
    		setVisible(SecurityUtils.getAuthUser() != null && getComment() != null);
    	}
    	
    });
    

    correct?

  • Robin Shen commented 1 year ago

    Wicket is a server side framework. This won't work. Also select portion of text and press quote button is not obvious to users. Why not just copy and paste?

  • wojtek commented 1 year ago

    Wicket is a server side framework. This won't work.

    I'm aware :) Hence my asking if it doesn't have any access to DOM itself and the broader context from the point for the browser. Though it has some "dynamicysm" included hence me wondering if it would have somehow access to window.getSelection()

    Also select portion of text and press quote button is not obvious to users.

    Could you elaborate? That it would quote only selection and not the whole comment?

    I'd argue that majority of websites offers this feature so users (developers) would be quite accustomed to it. Some forums/bulettin-bards go further end even have onSelect pop-up with option to quote/add-to-multi-quote (see xeno forums or even better discourse with comment entry window being sticky to the bottom of the view) which is quite convenient.

    Why not just copy and paste?

    Because it's easier/faster. Especially if the comment is large and the entry-form is not visible: you have to select-copy-scroll down-paste-go-back and repeat. Even if not going for multi-quote (i.e. you select portion and then choose quote multiple parts of the text like in discourse) quote action already scrolls down and puts the cursor at the right place (after the quote).

    One "workaround" is just to quote everything and just cut portions of the text that are not relevant, but this breaks with incomming-html-emails and as pointed out in the last comments in #1727 it would be better to select-quote. (I'd argue that using flexmark-html2md-converter for handling incoming html-email, especially if it's not a "common case" would be better in this case…).

    Right now I'm just ponder whipping up a UserJS custom script that would handle this case (though it would work only on the browser where it's configured) :)

  • Robin Shen commented 1 year ago

    You will need non-trivial javascript embedded at client side to pass selected text (and even format) into backend.

    As to why not obvious. Users normally do not know they can select a portion of text and click quote button to quote that text. Showing a popup is better when select a portion of text, but it is not worth the effort just for this feature.

  • wojtek commented 1 year ago

    You will need non-trivial javascript embedded at client side to pass selected text (and even format) into backend.

    OK, so I was toying with the idea from the client-side perspective (creating UserJS) and indeed the handling is 'interesting' as in - the textarea has some shadow element that handles the contents so simply setting value to it doesn't work... at least I tried :)

    Maybe I'll try to figure it out later on, but it would still be hacking around Wicket…

    As to why not obvious. Users normally do not know they can select a portion of text and click quote button to quote that text.

    I can't say only from my personal experience but usually that would be expected (as it's quite popular). Though agreed that context pop-up makes that more explicit.

issue 1/1
Type
New Feature
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-1948
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover