Skip to content

Commit f700a90

Browse files
author
Dylan Just
committed
Instantiating TinyMCE
1 parent d4b708f commit f700a90

5 files changed

Lines changed: 237 additions & 14 deletions

File tree

notes.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Ideas for more exercises:
2+
3+
Millie suggested:
4+
Basic “how to set up custom UI” exercises. We do it occasionally for actual development, but we do it a lot for
5+
support cases, creating demos, etc. And I think it would be a good introduction to the wider concepts of Alloy and such.
6+
E.g. custom toolbar buttons are in https://www.tiny.cloud/docs/ui-components/toolbarbuttons/ and
7+
https://www.tiny.cloud/docs/ui-components/typesoftoolbarbuttons/. And menu items are at
8+
https://www.tiny.cloud/docs/ui-components/menuitems/
9+
10+

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",
6-
"type": "module",
76
"scripts": {
87
"test": "echo \"Error: no test specified\" && exit 1",
98
"build": "tsc -b"
@@ -26,7 +25,11 @@
2625
"devDependencies": {
2726
"@ephox/bedrock-client": "^9.6.1",
2827
"@ephox/bedrock-server": "^9.6.3",
28+
"awesome-typescript-loader": "^5.2.1",
2929
"fast-check": "^2.2.1",
30-
"typescript": "^4.0.2"
30+
"typescript": "^4.0.2",
31+
"webpack": "^4.44.1",
32+
"webpack-cli": "^3.3.12",
33+
"webpack-dev-server": "^3.11.0"
3134
}
3235
}

src/main/html/Part1Exercise1.html

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<title>Exercise 1 - instantiating TinyMCE</title>
5+
6+
<!--
7+
Instantiating TinyMCE is one of the first things TinyMCE users need to do, so it makes sense for this to be
8+
our first exercise.
9+
10+
TODO Head over to https://www.tiny.cloud/ and sign up for an API key. Replace the 'no-api-key' with your api key in the below script tag.
11+
-->
12+
<script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script>
13+
</head>
14+
<body>
15+
16+
<!--
17+
This project has webpack configured. Run `yarn webpack-dev-server` and navigate to
18+
http://localhost:8080/src/main/html/Part1Exercise1.html to view this page.
19+
20+
tinymce.init is the most important API function of TinyMCE. In its most basic form, you specify a CSS selector for an
21+
element, and a TinyMCE editor appears where the element was:
22+
-->
23+
<textarea id="editor1"></textarea>
24+
<script>tinymce.init({ selector: '#editor1' });</script>
25+
26+
<!--
27+
If you inspect the DOM in your browser, you'll notice that the textarea has been hidden, and editor dom elements created
28+
beside the textarea.
29+
30+
Since a selector can match multiple elements, you can use tinymce.init to create multiple editors.
31+
TODO In the below script tag, instantiate TinyMCE editors in the below
32+
-->
33+
<textarea class="editorSet"></textarea>
34+
<textarea class="editorSet"></textarea>
35+
<script></script>
36+
37+
38+
<!--
39+
TinyMCE is very customizable. Let's customize it. I'll throw you in the deep end a bit, with just some requirements and
40+
documentation, as this is what our customers start with.
41+
42+
Docs can be found here:
43+
https://www.tiny.cloud/docs
44+
45+
List of toolbars items can be found here:
46+
https://www.tiny.cloud/docs/advanced/editor-control-identifiers/#toolbarcontrols
47+
48+
49+
TODO Instantiate a TinyMCE editor with no menu bar, no status bar, and toolbar buttons to do the following:
50+
- make text bold
51+
- insert a table
52+
- make the editor full screen
53+
- view/edit source code
54+
55+
Note: you'll need to add some plugins for these to work.
56+
-->
57+
58+
59+
</body>
60+
61+
</html>

src/main/ts/Webpack.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Dummy entry point for webpack. See webpack.config.js

0 commit comments

Comments
 (0)