commit 2dbd318bc62ccced71ac89c67d0d707961c68d02 Author: Frederik Hanghøj Iversen Date: Tue May 7 11:11:18 2019 +0200 Hello world diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..936e5c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/node_modules/ +/package-lock.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..57b1080 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Tribute Iframe Issue + +How to run: + + npm install + npm i -g http-server + http-server . + # Open link + # Follow on-screen instructions diff --git a/index.html b/index.html new file mode 100644 index 0000000..9316e2b --- /dev/null +++ b/index.html @@ -0,0 +1,18 @@ + + + + Tribute Iframe Issue + + + + + + +

Type "@P" in the box below.

+

Expected behaviour: A popup is shown with a suggestion.

+

Actual behaviour: No popup is shown.

+
+ +
+ + diff --git a/index.js b/index.js new file mode 100644 index 0000000..226cf3d --- /dev/null +++ b/index.js @@ -0,0 +1,21 @@ +const initTribute = (element) => { + const values = [ + {key: 'Phil Heartman', value: 'pheartman'}, + {key: 'Gordon Ramsey', value: 'gramsey'} + ]; + new Tribute({ + values: values + }).attach(element); +}; + +const getSubdoc = () => document + .querySelector('iframe') + .contentDocument; + +const init = () => { + initTribute(getSubdoc().querySelector('.editor')); +}; + +document + .querySelector('iframe') + .addEventListener('load', init); diff --git a/package.json b/package.json new file mode 100644 index 0000000..0bf1ace --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "dependencies": { + "tributejs": "^3.6.0" + }, + "name": "Tribute Iframe Issue", + "version": "1.0.0", + "main": "index.js", + "license": "MIT" +} diff --git a/subdoc.html b/subdoc.html new file mode 100644 index 0000000..d2010a6 --- /dev/null +++ b/subdoc.html @@ -0,0 +1,8 @@ + + + +
+
+
+ +