test_Editor.html 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2. "http://www.w3.org/TR/html4/strict.dtd">
  3. <html>
  4. <head>
  5. <title>Editor Test</title>
  6. <style type="text/css">
  7. @import "../../dojo/resources/dojo.css";
  8. @import "css/dijitTests.css";
  9. </style>
  10. <script type="text/javascript" src="../../dojo/dojo.js"
  11. djConfig="parseOnLoad: true, isDebug: true"></script>
  12. <script type="text/javascript" src="_testCommon.js"></script>
  13. <script type="text/javascript" src="../Editor.js"></script>
  14. <script type="text/javascript">
  15. dojo.require("dijit.Editor");
  16. dojo.require("dijit._editor.plugins.AlwaysShowToolbar");
  17. dojo.require("dijit._editor.plugins.EnterKeyHandling");
  18. // dojo.require("dijit._editor.plugins.FontChoice"); // 'fontName','fontSize','formatBlock'
  19. dojo.require("dijit._editor.plugins.TextColor");
  20. dojo.require("dijit._editor.plugins.LinkDialog");
  21. dojo.require("dojo.parser"); // scan page for widgets and instantiate them
  22. </script>
  23. </head>
  24. <body>
  25. <h1 class="testTitle"><label for="editor1">Editor + Plugins Test</label></h1>
  26. <div style="border: 1px solid black;">
  27. <div dojoType="dijit.Editor" id="editor1"><p>This instance is created from a div directly with default toolbar and plugins</p></div>
  28. </div>
  29. <button onClick="dijit.byId('editor1').destroy()">destroy</button>
  30. <button onclick="console.log(dijit.byId('editor1').getValue().length)">getValue</button>
  31. <hr/>
  32. <div style="border: 1px dotted black;">
  33. <h3><label for="thud">thud - from textarea</label></h3>
  34. <textarea dojoType="dijit.Editor" height=""
  35. extraPlugins="['dijit._editor.plugins.AlwaysShowToolbar']"
  36. styleSheets="../../dojo/resources/dojo.css" id="thud">
  37. <p>
  38. This editor is created from a textarea with AlwaysShowToolbar plugin (don't forget to set height="").
  39. </p>
  40. <p>
  41. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
  42. semper sagittis velit. Cras in mi. Duis porta mauris ut ligula. Proin
  43. porta rutrum lacus. Etiam consequat scelerisque quam. Nulla facilisi.
  44. Maecenas luctus venenatis nulla. In sit amet dui non mi semper iaculis.
  45. Sed molestie tortor at ipsum. Morbi dictum rutrum magna. Sed vitae
  46. risus.
  47. </p>
  48. </textarea>
  49. <h3>..after</h3>
  50. </div>
  51. <hr/>
  52. <div style="border: 1px dotted black;">
  53. <h3><label for="blah">blah entry</label></h3>
  54. <textarea dojoType="dijit.Editor"
  55. plugins="['bold','italic','|','createLink','foreColor','hiliteColor']"
  56. styleSheets="../../dojo/resources/dojo.css" id="blah">
  57. This instance includes optional toolbar buttons which pull in additional ui (dijit) code.
  58. Note the dojo.require() statements required to pull in the associated editor plugins to make
  59. this work.
  60. </textarea>
  61. <h3>..after</h3>
  62. </div>
  63. <hr/>
  64. <div style="border: 1px dotted black;">
  65. <h3><label for="blah2">Another blah entry</label></h3>
  66. <textarea dojoType="dijit.Editor"
  67. plugins="['bold','italic','|',{name:'dijit._editor.plugins.LinkDialog'}]"
  68. styleSheets="../../dojo/resources/dojo.css" id="blah2">
  69. This instance demos how to:
  70. <ol>
  71. <li>specify which plugins to load (see the plugins property): this instance loads EnterKeyHandling plugin, among others;</li>
  72. <li>specify options for a plugin (see the last item in the plugins array)</li>
  73. </ol>
  74. </textarea>
  75. <h3>..after</h3>
  76. </div>
  77. </body>
  78. </html>