Skip to content
Snippets Groups Projects
Commit 09dae5ea authored by Andreas Gohr's avatar Andreas Gohr
Browse files

select sample in tb_formatln()

Ignore-this: 85ca1838ed81f69512d07d8504f6673f

Note: development is part of ICKE 2.0 project
      http://www.icke-projekt.de

darcs-hash:20090827115144-6e07b-2cfd3c592de4a734cf92cbb2416a9a50f558cfdb.gz
parent 42e90eeb
No related branches found
No related tags found
No related merge requests found
......@@ -96,16 +96,26 @@ function tb_formatln(btn, props, edid) {
}
sample = fixtxt(sample);
var selection = getSelection($(edid));
if(selection.getLength()) sample = selection.getText();
props['open'] = fixtxt(props['open']);
props['close'] = fixtxt(props['close']);
// is something selected?
var opts;
var selection = getSelection($(edid));
if(selection.getLength()){
sample = selection.getText();
opts = {nosel: true};
}else{
opts = {
startofs: props['open'].length,
endofs: props['close'].length
};
}
sample = sample.split("\n").join(props['close']+"\n"+props['open']);
sample = props['open']+sample+props['close'];
pasteText(selection,sample,{nosel: true});
pasteText(selection,sample,opts);
pickerClose();
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment