Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edit buttons not appearing for popup windows #158

Open
jmvanel opened this issue Aug 6, 2015 · 1 comment
Open

edit buttons not appearing for popup windows #158

jmvanel opened this issue Aug 6, 2015 · 1 comment

Comments

@jmvanel
Copy link

jmvanel commented Aug 6, 2015

Here is the JavaScript I use to launch a Pen window on double click :

function launchEditorWindow(elem) {
  var popupWindow = window.open('', 'windowName', 'height=300,width=300');
  var options = {
    editor: popupWindow.document.body,
    class: 'pen',
    list: // editor menu list
    [ 'insertimage', 'blockquote', 'h2', 'h3', 'p', 'code', 'insertorderedlist', 'insertunorderedlist', 'inserthorizontalrule',
      'indent', 'outdent', 'bold', 'italic', 'underline', 'createlink' ]
  }}
  popupWindow.document.body.innerHTML = elem.value
  var editor = new Pen( options );
  popupWindow.onbeforeunload = function() {
    elem.value = editor.toMd(); // return a markdown string
  };
}```
@jmvanel
Copy link
Author

jmvanel commented Jan 3, 2016

The problem: for a popup window created by program, most facilities of Pen do not work; the tool bar, the commands followed by space. Only the return key has an effect.

Here is a complete HTML to reproduce the problem.

<html>
<script src="http://sofish.github.io/pen/src/pen.js"></script>
<script type="text/javascript">
  var popupWindow = window.open( '', 'windowName', 'height=300,width=300');
  var editorDiv = popupWindow.document.createElement("div");
  var body = popupWindow.document.body;
  body.appendChild(editorDiv);
  editorDiv.textContent = '?';

  var options = { editor: editorDiv };
  var editor = new Pen(options);
  pen.focus();
</script>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant