createMarkdownPre
by
sugargoodman
2014-03-01 [2014/03/01 00:41:10]
テキストエリアの選択範囲の行頭にスペースを4つ入れる
@@ -11,6 +11,5 @@
var bef = $('textarea').selection();
var aft = bef.replace(/^/g, ' ');
aft = aft.replace(/\n/g, '\n ');
-console.log(aft);
$('textarea').selection('replace',{text: aft});
/*
* @title createMarkdownPre
* @description テキストエリアの選択範囲の行頭にスペースを4つ入れる
* @include
* @license MIT License
* @require https://code.jquery.com/jquery-1.11.0.min.js
* @require https://raw.github.com/madapaja/jquery.selection/master/src/jquery.selection.js
* @javascript_url
*/
var bef = $('textarea').selection();
var aft = bef.replace(/^/g, ' ');
aft = aft.replace(/\n/g, '\n ');
$('textarea').selection('replace',{text: aft});
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。