32 lines
1.6 KiB
HTML
32 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>HTMLInfo Text Editor</title>
|
|
<meta name="description" content="A re-implementation of the default text editor." />
|
|
<!-- Copyright 1998-2017 by Northwoods Software Corporation. -->
|
|
<meta charset="UTF-8">
|
|
<script src="../assets/js/goSamples.js"></script> <!-- this is only for the GoJS Samples framework -->
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="sample">
|
|
<!-- The DIV for the Diagram needs an explicit size or else we won't see anything.
|
|
Also add a border to help see the edges. -->
|
|
<div id="myDiagramDiv" style="border: solid 1px black; width:400px; height:400px"></div>
|
|
<p>This sample constructs an <a>HTMLInfo</a> that acts as a re-implementation of the default text editor.
|
|
<p>The implementation is contained in the file <a href="TextEditor.ts" target="_blank">TextEditor.js</a>
|
|
and exposes <code>window.TextEditor</code>,
|
|
which is used in this file as the value of <code>myDiagram.toolManager.textEditingTool.defaultTextEditor</code>.
|
|
<p>This also adds a text validation predicate, <code>okName</code>, as the <a>TextBlock.textValidation</a> property.
|
|
That predicate makes sure that the new string has at least three characters and contains a vowel.
|
|
<p>You can see additional custom text editors in the <a href="../samples/customTextEditingTool.html">Custom TextEditingTool sample</a>.
|
|
</div>
|
|
<script src="../samples/assets/require.js"></script>
|
|
<script>
|
|
require(["TextEditorScript", "TextEditor"], function (app) {
|
|
app.init();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |