Skip to content

Instantly share code, notes, and snippets.

@sebmaynard
Last active October 3, 2022 18:09
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save sebmaynard/8f9f6b33247ab2f4bc85 to your computer and use it in GitHub Desktop.
Save sebmaynard/8f9f6b33247ab2f4bc85 to your computer and use it in GitHub Desktop.
Evernote HTML Editor
/*
Copyright 2015 Seb Maynard
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var getCurrentContent = function() {
return $("#tinymce", $("iframe").contents()).first().html();
};
var setCurrentContent = function(content) {
$("#tinymce", $("iframe").contents()).first().html(content);
$(".ennote", $("iframe").contents()).first().html(content);
};
var popupTextArea = function() {
var theDiv = $("<" + "div style='text-align: right; z-index: 1000000; position: fixed; top: 20px; left: 20px; right: 20px; bottom: 20px;'><" + "/div>");
var theTextArea = $("<" + "textarea style='display: block; width: 100%; height: 90%;'><" + "/textarea>");
theTextArea.val(getCurrentContent());
var theButton = $("<" + "input type='button' value='save' />");
theButton.click(function() {
setCurrentContent(theTextArea.val());
theDiv.remove();
});
theDiv.append(theTextArea);
theDiv.append(theButton);
$("body").append(theDiv);
};
popupTextArea();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment