Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A bookmarklet for richtext editor without 3rd-part javascript code
data:text/html;base64,PGh0bWw+CjxoZWFkPgo8dGl0bGU+UmljaCBUZXh0IEVkaXRvcjwvdGl0bGU+CjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4KdmFyIG9Eb2MsIHNEZWZUeHQ7CgpmdW5jdGlvbiBpbml0RG9jKCkgewogIG9Eb2MgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgidGV4dEJveCIpOwogIHNEZWZUeHQgPSBvRG9jLmlubmVySFRNTDsKICBpZiAoZG9jdW1lbnQuY29tcEZvcm0uc3dpdGNoTW9kZS5jaGVja2VkKSB7IHNldERvY01vZGUodHJ1ZSk7IH0KfQoKZnVuY3Rpb24gZm9ybWF0RG9jKHNDbWQsIHNWYWx1ZSkgewogIGlmICh2YWxpZGF0ZU1vZGUoKSkgeyBkb2N1bWVudC5leGVjQ29tbWFuZChzQ21kLCBmYWxzZSwgc1ZhbHVlKTsgb0RvYy5mb2N1cygpOyB9Cn0KCmZ1bmN0aW9uIHZhbGlkYXRlTW9kZSgpIHsKICBpZiAoIWRvY3VtZW50LmNvbXBGb3JtLnN3aXRjaE1vZGUuY2hlY2tlZCkgeyByZXR1cm4gdHJ1ZSA7IH0KICBhbGVydCgiVW5jaGVjayBcIlNob3cgSFRNTFwiLiIpOwogIG9Eb2MuZm9jdXMoKTsKICByZXR1cm4gZmFsc2U7Cn0KCmZ1bmN0aW9uIHNldERvY01vZGUoYlRvU291cmNlKSB7CiAgdmFyIG9Db250ZW50OwogIGlmIChiVG9Tb3VyY2UpIHsKICAgIG9Db250ZW50ID0gZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUob0RvYy5pbm5lckhUTUwpOwogICAgb0RvYy5pbm5lckhUTUwgPSAiIjsKICAgIHZhciBvUHJlID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgicHJlIik7CiAgICBvRG9jLmNvbnR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