Format Painter docs

This commit is contained in:
shikha
2019-01-07 15:43:51 +10:00
parent 9e7081a917
commit fc5a0acf58
6 changed files with 152 additions and 0 deletions
+4
View File
@@ -28,6 +28,7 @@
- url: "whats-new"
- url: "basic-example"
- url: "full-featured"
- url: "formatpainter"
- url: "drive"
- url: "editor-dfree"
- url: "inline"
@@ -236,6 +237,7 @@
- url: "drive"
- url: "emoticons"
- url: "mediaembed"
- url: "formatpainter"
- url: "fullpage"
pages:
- url: "#fullpage_default_doctype"
@@ -311,6 +313,7 @@
- url: "#video_template_callback"
- url: "mentions"
- url: "moxiemanager"
- url: "formatpainter"
- url: "nonbreaking"
pages:
- url: "#nonbreaking_force_tab"
@@ -423,6 +426,7 @@
# - url: "tiny-comments"
- url: "tinydrive"
- url: "moxiemanager"
- url: "formatpainter"
- url: "paste-from-word"
- url: "check-spelling"
pages:
+15
View File
@@ -0,0 +1,15 @@
---
layout: default
title: Format Painter
title_nav: Format Painter
description: Quickly apply formats to multiple pieces of text.
keywords: formats formatting edit formatpainter_removeformat formatpainter_tableformats formatpainter_blacklisted_formats format painter configuration
controls: toolbar button
---
## Live example
This example shows how to use Format Painter Format Painter plugin to copy and paste formatting from one location to another. For more information on the Format Painter plugin, see the [docs]({{site.baseurl}}/plugins/formatpainter/).
<!-- {% include codepen.html id="format-painter" %} -->
+30
View File
@@ -0,0 +1,30 @@
---
layout: default
title: Format Painter
title_nav: Format Painter
description: Quickly apply formats to multiple pieces of text.
keywords: formats formatting edit formatpainter_removeformat formatpainter_tableformats formatpainter_blacklisted_formats format painter configuration
controls: toolbar button
---
The Format Painter plugin allows a user to copy and paste formatting from one location to another, such as font style and size.
The format painter retains the formatting after application making it possible to apply the same formatting multiple times by using the `Ctrl+Alt+V` keyboard shortcut.
The ability to reuse existing formatting saves the user time and ensures consistency across the content.
### Getting started
#### Creating an account
To try out Format Painter and Tiny Cloud-delivered editor, the first step is to create a free [Tiny account](https://www.tiny.cloud/download/).
> The free user account provisioned with a free 30-day trial of all Tiny [premium plugins](https://apps.tiny.cloud/product-category/tiny-cloud-extensions/), with no credit card information or commitment required.
### Buy TinyMCE Format Painter
Start with this [dedicated product page](https://about.tiny.cloud/products/formatpainter/) to see all the flexible pricing options. OEM and enterprise customers should [contact sales directly](https://www.tinymce.com/pricing/).
For more information on Format Painter refer to the full [documentation]({{site.baseurl}}/plugins/formatpainter/).
There is also a demo provided to explore the Format Painter capabilities [here]({{site.baseurl}}/demo/formatpainter/).
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

+103
View File
@@ -0,0 +1,103 @@
---
layout: default
title: Format Painter
title_nav: Format Painter
description: Quickly apply formats to multiple pieces of text.
keywords: formats formatting edit formatpainter_removeformat formatpainter_tableformats formatpainter_blacklisted_formats format painter configuration
controls: toolbar button
---
The Format Painter plugin allows a user to copy and paste formatting from one location to another, such as font style and size. The format painter is capable of working with a wide variety of formats such as inline and block formats and styles such as table styles.
Format Painter is a premium plugin from Tiny. Please see the [Premium features]({{site.baseurl}}/enterprise/formatpainter/) section for all the buying options.
Once you have obtained the Format Painter plugin, refer to the following instructions for using it.
### Configuring the Format Painter toolbar button
Use the following script to configure the Format Painter toolbar button:
##### Example
```js
tinymce.init({
selector: "textarea", // change this value according to your HTML
plugins: "formatpainter",
toolbar: "formatpainter"
});
```
**Result**:
The ![**Format Painter**]({{site.baseurl}}/images/fp-disabled.png)(**Format Painter**) button appears in the toolbar menu.
## Using Format Painter
The format painter is accessed using either keyboard shortcuts or a toolbar button.
The format painter operates in two modes, one for retrieval and one for application of formatting. The usage of the keyboard is slightly different from the usage of the toolbar buttons.
**Usage with toolbar button**
1. Position the cursor at the source content to retrieve the formatting.
2. Enable the **Format Painter** button to copy the formatting. The **Format Painter** toolbar button background color changes to _grey_ ![**Format Painter**]({{site.baseurl}}/images/fp-enabled.png).
3. Select the goal content to apply the formatting.
**Result**: The formatting from the source content is applied to the goal content.
**Usage with keyboard**
1. Position the cursor at the source content to retrieve formatting.
2. Press the `Ctrl+Alt+C` keys to read the formatting.
3. Select the goal content to apply the formatting.
4. Press the `Ctrl+Alt+V` keys to apply the formatting.
> The format painter retains the formatting after application making it possible to apply the same formatting multiple times by using the `Ctrl+Alt+V` keyboard shortcut.
## Options
The format painter acts upon all [`formats`]({{ site.baseurl }}/configure/content-formatting/#formats) registered in the editor. In addition to any standard formatting, it will treat **lists** as a block format whenever the [`lists plugin`]({{ site.baseurl }}/plugins/lists/) is made available.
### `formats`
The format painter plugin will register many formats upon initialization. To override these formats, use the [`formats`]({{ site.baseurl }}/configure/content-formatting/#exampleofusageoftheformatsoption) option.
<br/>
The example below showcases the formats registered automatically by the plugin upon initialization. The `formatpainter_removeformat` is used to clear any existing formats before applying the new ones. It is similar to the [`removeformat`]({{ site.baseurl }}/configure/content-formatting/#removingaformat) format.
**Type:** `Object`
##### Example
```js
tinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'formatpainter',
formats: {
borderstyle: { selector: 'td,th', styles: { borderTopStyle: '%valueTop', borderRightStyle: '%valueRight', borderBottomStyle: '%valueBottom', borderLeftStyle: '%valueLeft', }, remove_similar: true },
bordercolor: { selector: 'td,th', styles: { borderTopColor: '%valueTop', borderRightColor: '%valueRight', borderBottomColor: '%valueBottom', borderLeftColor: '%valueLeft' }, remove_similar: true },
backgroundcolor: { selector: 'td,th', styles: { backgroundColor: '%value' }, remove_similar: true },
formatpainter_removeformat: [
{ selector: 'b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins', remove: 'all', split: true, expand: false, block_expand: true, deep: true },
{ selector: 'span', attributes: ['style', 'class'], remove: 'empty', split: true, expand: false, deep: true },
{ selector: '*:not(tr,td,th,table)', attributes: ['style', 'class'], split: false, expand: false, deep: true }
]
}
});
```
### `formatpainter_blacklisted_formats`
This option makes it possible to block the unwanted formats in the format painter.
**Type:** `String`
**Default:** `'link,address,removeformat,formatpainter_removeformat'`
##### Example
```js
tinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'formatpainter',
formatpainter_blacklisted_formats: 'link,address,removeformat,formatpainter_removeformat'
});
```
Check out the [Format Painter demo]({{site.baseurl}}/demo/formatpainter/) to try out this new feature.