Skip to content

Commit b55b3a1

Browse files
authored
DOC-3156: Clarify skin creation instructions in UI customization documentation (TinyMCE v5). (#3641)
* DOC-3156: Remove references to skin tool from the tinymce/5 documentation content. * DOC-3156: Clarify skin creation instructions in UI customization documentation.
1 parent 96e950b commit b55b3a1

File tree

2 files changed

+119
-71
lines changed

2 files changed

+119
-71
lines changed
Lines changed: 118 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,110 @@
1-
= Create a skin for TinyMCE
2-
:description: Introducing skin creation, less and icon modification.
3-
:description_short: Introducing skin creation.
4-
:keywords: create creator skin icon
5-
:title_nav: Create a skin
1+
= Create a Skin for {productname}
2+
:navtitle: Create a Skin
3+
:description_short: Introduction to skin creation.
4+
:description: Learn how to create a custom skin, modify Less variables, and update icons for {productname}.
5+
:keywords: create, skin, customization, icon, Less
66

7-
This section provides information on how to manually create a new skin to customize the appearance of {productname} {productmajorversion}.
8-
9-
The {productname} Skin Tool provides an interactive method for designing and creating a skin for {productname}, visit: http://skin.tiny.cloud/[http://skin.tiny.cloud/].
7+
This guide explains how to manually create a new skin to customize the appearance of {productname} {productmajorversion}.
108

119
== Prerequisites
1210

13-
This guide assumes:
11+
Before beginning, ensure that:
1412

15-
* Familiarity with the command line and running simple commands.
16-
* https://nodejs.org/en/[Node.js], https://yarnpkg.com/en/[Yarn] and https://gulpjs.com[Gulp] are already installed.
17-
* Basic understanding of http://lesscss.org[Less], the CSS preprocessor we use to build the skins. More specifically, http://lesscss.org/features/#variables-feature[read the section about variables].
13+
* Familiarity with the command line and basic commands is established.
14+
* link:https://nodejs.org/en/[Node.js] and link:https://yarnpkg.com/en/[Yarn] are already installed.
15+
* A basic understanding of link:http://lesscss.org[Less], the CSS preprocessor used to build skins, is required. Specifically, review the link:http://lesscss.org/features/#variables-feature[section on variables].
1816

1917
== Preparation
2018

21-
The CSS that goes with a theme is called a skin. The default skin for {productname} {productmajorversion} is named Oxide and is written in http://lesscss.org[Less], a popular CSS preprocessor. With Oxide we introduced a concept we call the *Style API*. This API consists of around 300 variables which you use to modify the appearance of {productname}. You never touch the underlying CSS. The benefit of this approach is that improvements we make to the CSS and HTML won't break your custom skin. This also means that if things don't work as expected, we can provide support and bug fixes, something that was virtually impossible before.
19+
The CSS associated with a theme is called a skin. The default skin for {productname} {productmajorversion} is **Oxide**, written in link:http://lesscss.org[Less]. Oxide introduces the *Style API*, which consists of approximately 300 variables that allow customization of {productname} without modifying the underlying CSS. This approach ensures compatibility with future updates and provides continued support for bug fixes.
2220

23-
IMPORTANT: We do not recommend modifying or overriding CSS rules directly.
21+
[IMPORTANT]
22+
{companyname} recommends not modifying or overriding CSS rules directly.
2423

25-
To set up the skin development environment, begin with the following steps:
24+
Follow these steps to set up the skin development environment:
2625

27-
. Download (or `git clone`) the https://github.com/tinymce/tinymce[{productname} source code].
28-
. Open the terminal and navigate to the folder you just downloaded.
29-
. Install dependencies with the command:
26+
. Download (or `+git clone+`) the link:https://github.com/tinymce/tinymce[{productname} source code].
27+
. Open a terminal and navigate to the folder you just downloaded.
28+
. Install dependencies and build the project using the following commands:
3029
+
31-
[source, sh]
30+
[source,sh]
3231
----
33-
yarn install
32+
yarn && yarn dev && yarn build
3433
----
35-
36-
. Launch the web server to preview the skins using the command:
34+
. Start the development server to preview skins:
3735
+
38-
[source, sh]
36+
[source,sh]
3937
----
4038
yarn oxide-start
4139
----
40+
. Once the server starts, open a browser and navigate to the displayed URL, typically `+http://localhost:3000+`.
4241

43-
You should now be able to open a web browser and point it to the url displayed in the terminal, usually `+http://localhost:3000+`.
44-
45-
The development environment is set up and ready to work.
42+
The development environment is now setup and should look similar to the following:
4643

47-
image::SDKforsilver.png[{productname} skin SDK for Silver theme]
44+
image::SDK-for-silver.png[{productname} skin SDK for Silver theme]
4845

49-
If you just need to build the skins without launching a web server, run:
46+
[NOTE]
47+
If required to modify the skin without launching a web server, run **`+yarn oxide-build+`** instead of **`+yarn oxide-start+`**.
5048

51-
[source, sh]
52-
----
53-
yarn oxide-build
54-
----
49+
== Creating or Editing a Skin
5550

56-
== Making or editing a skin
51+
Ensure completion of the preparation steps before proceeding.
5752

58-
Make sure you have performed the preparation steps above.
53+
=== Directory Structure
5954

60-
=== Overview
55+
Navigate to `+modules/oxide/src/less/skins/+`. This folder contains:
6156

62-
Navigate to `modules/oxide/src/less/skins/`. There are two folders in this location:
63-
* `/ui` - which is the skins for the editor. The important file here is `skin.less`.
64-
* `/content` - which is the skins for the content within the editor.
57+
. `+/ui+`: Contains editor UI skins. The main file here is `+skin.less+`.
58+
. `+/content+`: Contains skins for the content inside the editor.
6559

66-
The folder `modules/oxide/src/less/theme/` contains the Less files. At the top of most files you'll find the available variables that defines the default colors, margins, fonts etc (variables are the strings that starts with an at-character, for example `@background-color`). _Do not edit these files_, instead use them as a reference when creating your skin. We recommend starting with the two files containing global variables: `modules/oxide/src/less/theme/globals/global-variables.less` and the toolbar buttons: `modules/oxide/src/less/theme/components/toolbar-button/toolbar-button.less`.
60+
The `+modules/oxide/src/less/theme/+` folder contains Less files defining global styles. Most files list available variables at the top, such as colors, margins, and fonts. Variables are prefixed with `@` (e.g., `@background-color`).
6761

68-
The general workflow is that you look inside the less files within the theme folder and copy the variables you like to change into your skin's `skin.less` file.
62+
[IMPORTANT]
63+
====
64+
_Do not edit these files directly_. Instead, use them as references when creating a custom skin. Start by reviewing:
6965
70-
NOTE: The skin *only* changes the visual presentation of the UI and *not* the placement of elements. Placement of elements is done by the {productname} UI framework. This framework makes it possible to do complex UI layouts on all browsers without touching any CSS when plugins are created.
66+
* `+modules/oxide/src/less/theme/globals/global-variables.less+`
67+
* `+modules/oxide/src/less/theme/components/toolbar-button/toolbar-button.less+`
7168
72-
=== Creating a skin
69+
The typical workflow involves copying variables from the theme folder into the skins `skin.less` file and modifying them as needed.
70+
====
7371

74-
. Begin by duplicating the `default` folder located in `modules/oxide/src/less/skins/ui/` and rename it to the name of your skin.
75-
. Start the development server using the terminal command `yarn oxide-start`. If you already have the server running, you need to restart it to make it recognize your new skin using `ctrl-c` and then start it again.
76-
. Open the file `modules/oxide/src/less/skin/ui/<your-skin-name>/skin.less`.
77-
. Open any less file located in the theme folder, for example `modules/oxide/src/less/theme/globals/global-variables.less` and copy a variable you like to change, it's easiest to copy the whole line. Let's copy the `@background-color` variable to start with.
78-
. Paste the variable into the `skin.less` file you opened in step 2. For a striking look, change the variable value to be red, like this: `@background-color: red;`. Then save the file.
72+
[NOTE]
73+
Skins **only** affect the visual appearance of the UI. Element positioning is managed by {productname}'s UI framework.
7974

80-
Your skin.less file should now look like this:
75+
[[creating-a-skin]]
76+
=== Creating a Skin
8177

82-
[source, less]
78+
. Duplicate the `+default+` folder in `+modules/oxide/src/less/skins/ui/+` and rename it.
79+
. Rebuild the project to recognize the newly created skins by running:
80+
+
81+
[source,sh]
82+
----
83+
yarn build
84+
----
85+
. Start the development server by running:
86+
+
87+
[source,sh]
8388
----
84-
/**
85-
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
86-
* Licensed under the LGPL or a commercial license.
87-
* For LGPL see License.txt in the project root for license information.
88-
* For commercial licenses see https://www.tiny.cloud/
89-
*/
89+
yarn oxide-start
90+
----
91+
+
92+
[TIP]
93+
If the server is already running, restart it (`+Ctrl+C+`) and run the command again.
9094

95+
. Open `+modules/oxide/src/less/skin/ui/<your-skin-name>/skin.less+`.
96+
. Open a Less file from the theme folder (e.g., `+modules/oxide/src/less/theme/globals/global-variables.less+`) and copy a variable to modify. For example:
97+
+
98+
[source,less]
99+
----
100+
@background-color: red;
101+
----
102+
. Paste the variable into the `skin.less` file.
103+
+
104+
The updated `skin.less` should look like this:
105+
+
106+
[source,less]
107+
----
91108
@import 'src/less/theme/theme';
92109
93110
//
@@ -96,29 +113,60 @@ Your skin.less file should now look like this:
96113
97114
@background-color: red;
98115
----
99-
Switch to the web browser. Select your skin from the _Skin menu_. It should show a fiery red editor
116+
+
117+
. Save the file and check the changes in a browser. Select the skin from the _Skin menu_.
118+
. The editor should now display with a red background.
100119

101-
image::SDKforsilverCustomExample.png[{productname} skin SDK for Silver theme]
120+
image::SDK-for-silver-custom-example.png[{productname} Skin SDK for the Silver theme]
102121

103-
This is how you skin {productname}: copy variables from the files in the theme folder and paste them into your skin file. There are variables for most things, like spacing between toolbar buttons to letter spacing. Simple yet powerful.
122+
This method allows customization of {productname} by modifying predefined variables, such as toolbar spacing or letter spacing.
104123

105-
TIP: You can change the {productname} config in `modules/oxide/src/demo/index.html` to suit your particular use case.
124+
[TIP]
125+
Adjust {productname} configurations in `+modules/oxide/src/demo/index.html+` to match specific use cases.
106126

107-
== Creating a content CSS file
127+
== Creating a Content CSS File
108128

109-
To update the appearance of the content within the editor, such as headings, quotes, lists, etc... you create a content css. These are located in `modules/oxide/src/less/skin/content/`
129+
To modify the appearance of content inside the editor (e.g., headings, lists, quotes), create a content CSS file:
130+
131+
. Create a folder in `+modules/oxide/src/less/skins/content/+` and add a `content.less` file. Alternatively, duplicate an existing content CSS file.
132+
. Rebuild the project to recognize the newly created content skin.
133+
+
134+
[source,sh]
135+
----
136+
yarn build
137+
----
138+
. Start the development server:
139+
+
140+
[source,sh]
141+
----
142+
yarn oxide-start
143+
----
144+
+
145+
[TIP]
146+
If the server is already running, restart it (`+Ctrl+C+`) and run the command again.
147+
148+
. Add styles for relevant elements (`h1` to `h6`, `a`, `blockquote`, `code`, `table`, etc.). For example:
149+
+
150+
[source,less]
151+
----
152+
h1 {
153+
color: red;
154+
}
155+
----
156+
+
157+
. Save the file and check the changes in a browser.
158+
. The editor should now display with red headings.
110159

111-
. Create a folder in `modules/oxide/src/less/skins/content/` and create a `content.less` file in it. Alternatively, you can duplicate any of the existing content css.
112-
. Start the development server using the terminal command yarn oxide-start. If you already have the server running, you need to restart it to make it recognize your new skin using ctrl-c and then start it again.
113-
. Add the relevant element selectors for the desired use case such as `h1` to `h6`, `a`, `blockquote`, `code`, `table`, etc...
160+
== Moving the Skin into {productname}
114161

115-
== Moving the skin into TinyMCE
162+
. Copy the skin and/or content CSS from `+modules/oxide/build/skins/+` to the appropriate folders in the production {productname} setup.
163+
. Update {productname}'s initialization options:
116164

117-
. Copy the skin and/or content CSS from `modules/oxide/build/skins/` to the corresponding folders in your production {productname} folder.
118-
. Update the {productname} init function with the xref:editor-appearance.adoc#skin[skin] option and/or the xref:content-appearance.adoc#content_css[content_css] option.
165+
* Use the xref:editor-skin.adoc#skin[skin] option for UI skins.
166+
* Use the xref:add-css-options.adoc#content_css[content_css] option for content styles.
119167

120-
For more information on how to specify the location of the skin file, see xref:editor-appearance.adoc#skin_url[this] section.
168+
For details on specifying the skin file location, see xref:editor-skin.adoc#skin_url[this section].
121169

122-
== Modifying the icons
170+
== Modifying Icons
123171

124-
For information on adding custom icons, see: xref:creating-an-icon-pack.adoc[Create an icon pack for {productname}].
172+
For details on adding custom icons, see: xref:creating-an-icon-pack.adoc[Create an Icon Pack for {productname}].

modules/ROOT/pages/customize-ui.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ tinymce.init({
3434
});
3535
----
3636

37-
To create a skin interactively, visit http://skin.tiny.cloud/t5/[the {productname} 5 Skin Tool]. For information on manually creating skins for {productname}, see xref:creating-a-skin.adoc[Creating a skin].
37+
For information on manually creating skins for {productname}, see xref:creating-a-skin.adoc[Creating a skin].
3838

3939
NOTE: Developers often confuse the difference between {productname} "themes" and "skins". A *Skin* in {productname} is used to make changes to the appearance of the editor, for example, colors, margins, padding, fonts, icons, etc. A *Theme* creates the editor construction (left, top, bottom, or right of the editing area - vertical or horizontal, inline or outside, etc.). A skin usually changes the color scheme of a button, dialog, etc. while the theme applies to the whole editor including its functionality and has child skins to change the appearance.
4040

0 commit comments

Comments
 (0)