テーブル記法を挿入する (Insert table notation)
テーブルセル内で実行するとタブ文字を挿入する (Insert tab character within table cell)
テーブルセルではないところで実行するとtable:という文字列を挿入する (Otherwise it inserts the string table:)
2019/4/2
Update script to support new tables.
code:js
(function(){
const cursor = document.getElementsByClassName('cursor')0; const tableList = document.getElementsByClassName('table-block');
for (const table of tableList) {
if (isInside(cursor, table)) {
document.execCommand('insertText', false, '\t');
return;
}
}
document.execCommand('insertText', false, 'table:');
function isInside(insideElement, outsideElement) {
const insideRect = insideElement.getBoundingClientRect();
const outsideRect = outsideElement.getBoundingClientRect();
return outsideRect.left < insideRect.left
&& insideRect.right < outsideRect.right
&& outsideRect.top < insideRect.top
&& insideRect.bottom < outsideRect.bottom;
}
})();