/
githubmirror
/
markdown-here
Обзор
Документация
Войти
/
githubmirror
/
markdown-here
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v2.7.3
src/common/options-iframe.js
20 строк
653 B
Adam Pritchard
Moved preview markdown into separate iframe file. This is partly for moving towards adding some unit tests.
11 фев 2013, 01:28
11 фев 2013, 01:28
89c3216
Код
Авторство
О чём код?
/* * Copyright Adam Pritchard 2012 * MIT License : http://adampritchard.mit-license.org/ */ function onLoad() { // The body of the iframe needs to have a (collapsed) selection range for // Markdown Here to work (simulating focus/cursor). var range = document.createRange(); range.setStart(document.body, 0); var sel = document.getSelection(); sel.removeAllRanges(); sel.addRange(range); // Let our owner page know that we've loaded. var e = top.document.createEvent('HTMLEvents'); e.initEvent('options-iframe-loaded', true, true); top.document.dispatchEvent(e); } document.addEventListener('DOMContentLoaded', onLoad, false);