Editor.OpenFile()のポリフィル

2018年8月29日 (水) 23:55時点におけるKazy (トーク | 投稿記録)による版

Editor.OpenFile()は開いたDocumentオブジェクトを返さない.

Editor.OpenFile()が開いたDocumentオブジェクトを返すようにするポリフィル

Editor.OpenFile()が開いたDocumentオブジェクトを返すようになるまでは使えます。

引数の

file

が"c:\aaa\bbb\.\ccc\ddd.txt"のようにドットがあるとうまく動きません。引数のfileはドットが入らないように整えましょう。

function OpenFile(file, encoding, flags){
    var i, j, e, d;
    window.Editor.OpenFile(file, encoding, flags);
    for(i = 0; i < window.Editors.Count; i++){
        e = window.Editors.Item(i);
        for(j = 0; j < e.Documents.Count; j++){
            d = e.Documents.Item(j);
            if(d.FullName){
                if(d.FullName === file){
                    return d;
                }
            }
        }
    }
}
スポンサーリンク