tips:media_attached
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
tips:media_attached [2014-06-09 12:15] – [5. edit] 62.231.235.7 | tips:media_attached [2014-06-09 18:04] (current) – old revision restored (2013-03-21 13:15) 2001:4dd0:ff00:8eb9:fc80:1329:b7d9:1c50 | ||
---|---|---|---|
Line 431: | Line 431: | ||
</ | </ | ||
+ | ==== 5. edit ==== | ||
+ | lib/ | ||
+ | <code javascript> | ||
+ | function mediaSelect_attached(file){ | ||
+ | insertAtCarret_attached(window.parent.document.editform.wikitext,' | ||
+ | window.close(); | ||
+ | } | ||
+ | |||
+ | function insertAtCarret_attached(field, | ||
+ | //IE support | ||
+ | if (document.selection) { | ||
+ | field.focus(); | ||
+ | |||
+ | sel = window.parent.document.selection.createRange(); | ||
+ | |||
+ | sel.text = value; | ||
+ | // | ||
+ | }else if (field.selectionStart || field.selectionStart == ' | ||
+ | var startPos | ||
+ | var endPos | ||
+ | var scrollTop = field.scrollTop; | ||
+ | field.value = field.value.substring(0, | ||
+ | + value | ||
+ | + field.value.substring(endPos); | ||
+ | |||
+ | field.focus(); | ||
+ | var cPos=startPos+(value.length); | ||
+ | field.selectionStart=cPos; | ||
+ | field.selectionEnd=cPos; | ||
+ | field.scrollTop=scrollTop; | ||
+ | } else { | ||
+ | field.value += " | ||
+ | } | ||
+ | // reposition cursor if possible | ||
+ | if (field.createTextRange) field.caretPos = window.parent.document.selection.createRange().duplicate(); | ||
+ | } | ||
+ | </ |
tips/media_attached.txt · Last modified: 2014-06-09 18:04 by 2001:4dd0:ff00:8eb9:fc80:1329:b7d9:1c50