Created
January 2, 2024 23:33
-
-
Save wsalesky/00b872cd91c99344a030f0e667cb9e35 to your computer and use it in GitHub Desktop.
XSLTForms multiple tinymce editors in a single form.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml-stylesheet href="xsl/xsltforms.xsl" type="text/xsl"?> | |
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" | |
xmlns:ev="http://www.w3.org/2001/xml-events" | |
xmlns:xsltforms="http://www.agencexml.com/xsltforms" | |
xmlns:rte="http://www.agencexml.com/xsltforms/rte" lang="en"> | |
<head> | |
<meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover" /> | |
<title>TinyMCE Support</title> | |
<style type="text/css"> | |
.large-textarea textarea { | |
font-family: Courier, sans-serif; | |
height: 10em; | |
width: 500px; | |
}</style> | |
<script type="text/javascript" src="/exist/apps/xsltforms/scripts/tinymce_4.7.1/tinymce.min.js" data-uri="http://www.tinymce.com" data-version="4.7.1">/* */</script> | |
<model xmlns="http://www.w3.org/2002/xforms"> | |
<schema xmlns="http://www.w3.org/2001/XMLSchema" | |
targetNamespace="http://www.agencexml.com/xsltforms/rte"> | |
<simpleType name="standardHTML"> | |
<restriction xmlns:xforms="http://www.w3.org/2002/xforms" | |
xforms:xmlns="http://www.w3.org/2002/xforms" base="xforms:HTMLFragment" | |
xsltforms:rte="TinyMCE"/> | |
<annotation> | |
<appinfo> { plugins: [ "advlist autolink lists link image charmap print | |
preview anchor", "searchreplace visualblocks code fullscreen", | |
"insertdatetime media table contextmenu paste" ], toolbar: "insertelema | |
insertelemb | insertfile undo redo | styleselect | bold italic | | |
alignleft aligncenter alignright alignjustify | bullist numlist outdent | |
indent | link image", custom_elements: "~elem-a,~elem-b", content_style: | |
"elem-a {color: red; border-style: solid;} elem-b {color: blue; | |
border-style: solid;}", valid_elements: "p,i,strong,em,elem-a,elem-b", | |
setup: function(editor) { function insertElem(gi) { var s = "<" + gi | |
+ ">" + editor.selection.getContent() + "</" + gi + ">"; | |
editor.insertContent(s); } editor.addButton("insertelema", { text: | |
"elem-a", onclick: function() { insertElem("elem-a"); }, tooltip: | |
"Insert elem-a (red)" }); editor.addButton("insertelemb", { text: | |
"elem-b", onclick: function() { insertElem("elem-b"); }, tooltip: | |
"Insert elem-b (blue)" }); } } </appinfo> | |
</annotation> | |
</simpleType> | |
</schema> | |
<instance id="i-rec"> | |
<data xmlns="http://www.tei-c.org/ns/1.0"> | |
<richtext><p>Paragraph <i>number one</i></p></richtext> | |
<richtext><p>Paragraph <i>number one</i></p></richtext> | |
<summary>Summary 1</summary> | |
<summary>Summary 2</summary> | |
</data> | |
</instance> | |
<instance id="i-rec2"> | |
<data xmlns="http://www.tei-c.org/ns/1.0"> | |
<summary>irec2 Summary 1</summary> | |
<summary>irec2 Summary 2</summary> | |
</data> | |
</instance> | |
<instance id="main"> | |
<data xmlns=""> | |
<richtext><p>Paragraph <i>number one</i></p></richtext> | |
<richtext><p>Paragraph <i>number one</i></p></richtext> | |
<richtext><p>Paragraph <i>number one</i></p></richtext> | |
</data> | |
</instance> | |
<instance id="i-user"> | |
<data xmlns="http://www.tei-c.org/ns/1.0"> | |
</data> | |
</instance> | |
<bind nodeset="*:summary" type="rte:standardHTML"/> | |
<bind nodeset="*:richtext" type="rte:standardHTML"/> | |
</model> | |
</head> | |
<body> | |
<group xmlns="http://www.w3.org/2002/xforms"> | |
<repeat ref="instance('i-rec2')//*:summary"> | |
<textarea ref="." class="large-textarea" mediatype="application/xhtml+xml"/> | |
</repeat> | |
<repeat ref="instance('i-rec')//*:summary"> | |
<textarea ref="." class="large-textarea" mediatype="application/xhtml+xml"/> | |
</repeat> | |
<repeat ref="instance('i-rec')//*:richtext"> | |
<textarea ref="." class="large-textarea" mediatype="application/xhtml+xml"/> | |
</repeat> | |
<!-- | |
<repeat ref="instance('main')//richtext"> | |
<textarea ref="." class="large-textarea" mediatype="application/xhtml+xml"/> | |
</repeat> | |
--> | |
</group> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment