Skip to content

Commit 9ba47ed

Browse files
author
Sorita Heng
committed
add live demo
1 parent b1acbb3 commit 9ba47ed

File tree

5 files changed

+75
-46
lines changed

5 files changed

+75
-46
lines changed

antora.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ asciidoc:
1010
companyurl: https://www.tiny.cloud
1111
cdnurl: https://cdn.tiny.cloud/1/no-api-key/tinymce/7/tinymce.min.js
1212
tdcdnurl: https://cdn.tiny.cloud/1/_your_api_key_/tinydrive/7/tinydrive.min.js
13-
tinymce_live_demo_url: https://cdn.tiny.cloud/1/qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc/tinymce/7/tinymce.min.js
13+
tinymce_live_demo_url: https://internal-preview.tiny.work/epic/EPIC-134/tinymce.min.js
1414
tinydrive_live_demo_url: https://cdn.tiny.cloud/1/qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc/tinydrive/7/tinydrive.min.js
1515
webcomponent_url: https://cdn.jsdelivr.net/npm/@tinymce/tinymce-webcomponent@2/dist/tinymce-webcomponent.min.js
1616
jquery_url: https://cdn.jsdelivr.net/npm/@tinymce/tinymce-jquery@2/dist/tinymce-jquery.min.js
Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,9 @@
1-
/*
21

3-
This file is not normally required.
4-
5-
Sometimes, however, a plugin, or a particular feature of a plugin,
6-
requires a back-end service.
7-
8-
In these cases, creating a working demo requires setting up an
9-
emulated version of this service.
10-
11-
And `example.js` is part of this emulation.
12-
13-
`index.js` still runs the live demo.
14-
15-
But `example.js` is what is displayed in the *js* tab of the
16-
live-demo interface on the built docs site.
17-
18-
So `example.js` has to be a working equivalent to `index.js` *if*
19-
`index.js` was wired up in a standard way, to its required back-end
20-
service.
21-
22-
NB: there is one UX consequence of setting up demos to work in
23-
these cases. The *Edit on CodePen* tab does not — and cannot —
24-
present in the documentation.
25-
26-
The initial setup of these ‘includes-an-emulated-back-end’ examples
27-
will almost certainly include significant initial input from the
28-
plugin’s developer.
29-
30-
*/
2+
tinymce.init({
3+
selector: 'textarea#trackchanges',
4+
height: 500,
5+
plugins: 'trackchanges',
6+
toolbar: 'trackchanges',
7+
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
8+
trackchanges_uid: 'adamhenderson',
9+
});
Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
<textarea id="<plugincode>">
1+
<textarea id="trackchanges">
22
{{logofordemoshtml}}
33

4-
<!-- example html here -->
4+
<h2 style="text-align: center;">Welcome to the TinyMCE Track Changes demo!</h2>
55

6+
<p style="text-align: center;">Try out the Track Changes feature by typing in the editor and then clicking the Review Changes button in the toolbar.</p>
7+
8+
<p style="text-align: center;">And visit the <a href="https://www.tiny.cloud/pricing">pricing page</a> to learn more about our Premium plugins.</p>
9+
610
<h2>Found a bug?</h2>
711

812
<p>If you believe you have found a bug please create an issue on the <a href="https://github.com/tinymce/tinymce/issues">GitHub repo</a> to report it to the developers.</p>
@@ -12,4 +16,29 @@ <h2>Finally…</h2>
1216
<p>Don’t forget to check out <a href="http://www.plupload.com" target="_blank">Plupload</a>, the upload solution featuring HTML5 upload support.</p>
1317
<p>Thanks for supporting TinyMCE. We hope it helps you and your users create great content.</p>
1418
<p>All the best from the TinyMCE team.</p>
19+
20+
<h2>A simple table to play with</h2>
21+
22+
<table style="border-collapse: collapse; width: 100%;" border="1">
23+
<thead>
24+
<tr style="text-align: left;">
25+
<th>Product</th>
26+
<th>Cost</th>
27+
<th>Really?</th>
28+
</tr>
29+
</thead>
30+
<tbody>
31+
<tr>
32+
<td>TinyMCE Cloud</td>
33+
<td>Get started for free</td>
34+
<td><strong>Yes!</strong></td>
35+
</tr>
36+
<tr>
37+
<td>Plupload</td>
38+
<td>Free</td>
39+
<td><strong>Yes!</strong></td>
40+
</tr>
41+
</tbody>
42+
</table>
43+
1544
</textarea>
Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
1+
/** Fake user database */
2+
const userinfos = {
3+
adamhenderson: {
4+
uid: 'adamhenderson',
5+
name: 'Adam Henderson',
6+
avatar: `https://randomuser.me/api/portraits/men/1.jpg`,
7+
},
8+
michaelcook: {
9+
uid: 'michaelcook',
10+
name: 'Michael Cook',
11+
avatar: `https://randomuser.me/api/portraits/men/2.jpg`,
12+
},
13+
kalebwilson: {
14+
uid: 'kalebwilson',
15+
name: 'Kaleb Wilson',
16+
avatar: `https://randomuser.me/api/portraits/men/3.jpg`,
17+
},
18+
kyleeinstein: {
19+
uid: 'kyleeinstein',
20+
name: 'Kyle Einstein',
21+
avatar: `https://randomuser.me/api/portraits/men/4.jpg`,
22+
},
23+
};
24+
25+
const trackchanges_user_lookup = (uid) => new Promise((resolve, reject) =>
26+
setTimeout(() => userinfos[uid] ? resolve(userinfos[uid]) : reject(), 1000));
27+
28+
129
tinymce.init({
2-
selector: 'textarea#<plugincode>',
3-
// below is a basic 6.x working configuration.
4-
// Do not assume it is suitable for demonstrating the plugin to be documented.
30+
selector: 'textarea#trackchanges',
531
height: 500,
6-
plugins: [
7-
'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview',
8-
'anchor', 'searchreplace', 'visualblocks', 'code', 'fullscreen',
9-
'insertdatetime', 'media', 'table', 'help', 'wordcount'
10-
],
11-
toolbar: 'undo redo | blocks | ' +
12-
'bold italic backcolor | alignleft aligncenter ' +
13-
'alignright alignjustify | bullist numlist outdent indent | ' +
14-
'removeformat | help',
15-
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }'
32+
plugins: 'trackchanges',
33+
toolbar: 'trackchanges',
34+
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }',
35+
trackchanges_uid: 'adamhenderson',
36+
trackchanges_user_lookup,
1637
});

modules/ROOT/pages/trackchanges.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ tinymce.init({
7575
]
7676
}
7777
]
78-
}
78+
},
7979
trackchanges_uid: 'unique-identifier' // replace this with a unique string to identify the user
8080
});
8181
----

0 commit comments

Comments
 (0)