「選択した文字列を文書からすべて削除」の版間の差分

提供: MeryWiki
ナビゲーションに移動 検索に移動
Noah (トーク | 投稿記録)
初版
 
Noah (トーク | 投稿記録)
実装方法をJavaScriptではなくMeryのReplaceに変更(改行コードが変わってしまう問題を防ぐため)
11行目: 11行目:
var selection = document.selection.Text;
var selection = document.selection.Text;
if (selection != "") {
if (selection != "") {
document.Text = document.Text.split(selection).join("");
document.selection.Replace(selection, "", meFindReplaceCase | meReplaceAll | meFindKeepOptions);
}
}
</syntaxhighlight>
</syntaxhighlight>

2023年10月28日 (土) 18:29時点における版

概要

選択した文字列を文書からすべて削除するマクロです。置換ダイアログを開いて置換しても同じことができますが、こちらだと1アクションで実行できます。

ソースコード

#title="選択した文字列を文書からすべて削除"
/**
 * 選択した文字列を文書からすべて削除するマクロ
 */

var selection = document.selection.Text;
if (selection != "") {
	document.selection.Replace(selection, "", meFindReplaceCase | meReplaceAll | meFindKeepOptions);
}

更新履歴

  • 2023/10/28 初版
スポンサーリンク