Select a text to quote

This feature has been requested, but by default xenforo does not work this way.

Oh, I see.

I have asked this because I edit the editor_template.js and have changed the line 11:

Code:
+ selection.getContent().replace(/^<p>/, '').replace(/<\/p>$/, '')

To this:

Code:
+ window.getSelection()

And it works...But I really do not know if this is safe or something. Just wanted to share.
 
Now I understand. The "selection.getContent()" is the selection that we made inside the editor. If the selection is inside, it works. Out, do not.

Oh, I just saw the link. Thank you Digital.
 
Kier said:
March 13, 2011: It's something I've been playing with, but there is no generally agreed format for addressing the selection within a document, so this kind of feature tends to be extremely fragile.
Fuhrmann: if your code is clean maybe Kier would slip it into xF 1.1 (not likely mind you) :)
 
Looks good :)

Screencast-o-matic is cool as well.​
I've always wanted to see a forum "screenshot tool" that bypasses the local PC (ie. you can grab from the screen and post online without saving it locally).​
Almost feels like this could do that.​
 
I wonder if there is a mobile style that would allow people to take photos with their iphones and directly attach them to a forum ? Anyone know if forumrunner or the like allow that ?
 
This is what i have done:

Rich (BB code):
/*
* The following functions are bespoke and thus covered by a proprietary license.
*/
(function() {
var wrapBbCode = function(editor, tag)
{
var selection = editor.selection,
content, range, caret;
var range = window.getSelection().getRangeAt(0);
var startContainer = range.startContainer;
var spanNode = startContainer.ownerDocument.createElement("layer");
var docfrag = range.extractContents();
console.log(startContainer.parentNode);
spanNode.appendChild(docfrag);
range.insertNode(spanNode);
 
 
content = '[' + tag + ']'
+ spanNode.innerHTML
+ '<span id="__xfBbCaret">_</span>'
+ '[/' + tag + ']';
 
 
content = '<p>' + content + '</p>';
selection.setContent(content);
 
 
if (editor.getDoc().createRange)
{
caret = editor.dom.get('__xfBbCaret');
range = editor.getDoc().createRange();
range.setStartBefore(caret);
range.setEndBefore(caret);
selection.setRng(range);
}
editor.dom.remove('__xfBbCaret');
};
 
Not to me!
I've tried to implement this, but when I select something to quote and click the quote button, the post I'm quoting from get a line break inserted before and after the selected text. When I refresh the page that is restored though, but still, it's not a desired behavior. But I am glad you are working on this, a much "needed" function on my forum, since my users have had this function in my previous SMF installation. :)
 
I've tried to implement this, but when I select something to quote and click the quote button, the post I'm quoting from get a line break inserted before and after the selected text. When I refresh the page that is restored though, but still, it's not a desired behavior. But I am glad you are working on this, a much "needed" function on my forum, since my users have had this function in my previous SMF installation. :)

Yeah...still need some 'development', but I am glad that you liked!
 
Top Bottom