[wordpress插件] ACF Medium Editor FieldACF中型编辑器字段

wordpress 插件 文章 2020-01-27 00:20 621 0 全屏看文

AI助手支持GPT4.0

评分

100

100

描述

Compatibility

兼容性

This ACF field type is compatible with:

此ACF字段类型兼容:

* ACF 5

* ACF 5

This is an add on plugin for Advanced Custom Fields (ACF) 5. This plugin also requires either ACF Pro or the repeater field add on for ACF.

这是高级自定义字段(ACF)5的附加插件。此插件还需要ACF Pro或ACF的中继器字段附加。

This plugin will not work if ACF5 is not installed and active or if the ACF repeater field is not available.

如果未安装并激活ACF5或ACF转发器字段不可用,则此插件将不起作用。

This plugin may work in a limited capacity if the repeater field is not avilable.

如果中继器字段不可用,则此插件的功能可能有限。

Ever needed to give a client a way to edit the appearence of text without wanting to give them a full blown WYSIWYG editor?

是否曾经需要给客户一种方法来编辑文本的外观,而又不想给他们一个功能强大的所见即所得编辑器?

Need something less than a WYSYWIG but more than a text or textarea field that you can configure the way you need it to work with the features you need it to have?

您需要的不是WYSYWIG,而是文本或textarea字段,您可以配置所需的方式来使用所需的功能?

This add on for ACF5 adds MediumEditor as an ACF field.

此ACF5附加项将 MediumEditor 添加为ACF字段。

Each field instance is configurable, and each field instance has its own settings.

每个字段实例都是可配置的,并且每个字段实例都有自己的设置。

Many of the options

许多选项

available in MediumEditor are supported, including the creation of custom buttons using MediumButton.

支持MediumEditor中可用的功能,包括使用 MediumButton 创建自定义按钮。

It is also possible using either a configuration

也可以使用配置

setting or a filter to alter the MediumEditor Theme.

设置或过滤器以更改MediumEditor主题。

Some of the available options are covered below.

下面介绍了一些可用的选项。

For more information on MediumEditor and MediumButton, see the description of these libaries at the links provided.

有关MediumEditor和MediumButton的更多信息,请参见提供的链接中对这些库的描述。

For more information see

有关更多信息,请参见

Other Notes and

其他说明

Screenshots

屏幕截图

Medium Editor needs your help!.

Medium Editor需要您的帮助!

This plugin depends Medium Editor which is the JavaScript package that powers this ACF Add On.

此插件取决于 Medium Editor ,后者是为该ACF插件提供动力的JavaScript软件包。

I do not maintain this package.

我不维护此程序包。

This pluig is simply an implementation of it for ACF.

此插件只是针对ACF的实现。

Medium Editor is looking for contributors.

媒体编辑器正在寻找贡献者

Without people to help maintain and improve it Medium Editor could fade away and if that happens this plugin will also no longer be possible.

没有人员来帮助维护和改进它,Medium Editor可能会逐渐消失,如果发生这种情况,该插件也将不再可用。

Github Repository

Github存储库

This plugin is also on GitHub

此插件也在GitHub上

https://github.com/Hube2/acf-medium-editor

https://github.com/Hube2/acf-medium-editor

Field Settings

字段设置

The following is an explanation of the fields, not including the ones that should be self explanatory.

以下是对这些字段的解释,不包括那些应该自我解释的字段。

Buttons: These are the buttons that are included in MediumEditor

按钮:这些是 MediumEditor 中包含的按钮

a>.

a>。

Select the buttons you want to include in each editor instance.

选择要包含在每个编辑器实例中的按钮。

Custom Buttons: This is the main reason that I created this plugin.

自定义按钮:这是我创建此插件的主要原因。

This field supports adding

该字段支持添加

custom buttons using MediumButton.

使用 MediumButton 的自定义按钮。

Please note that if any of the main fields (Name, Label, HTML Tag) are empty that the entire

请注意,如果任何主要字段(名称,标签,HTML标记)为空,则表示整个

button will be ignored.

按钮将被忽略。

Name: This is then name of the button and will be used when instaniating the MediumButton Object.

名称 :这是按钮的名称,将在实例化MediumButton对象时使用。

The button name must be unique and cannot be one of the buttons already included in MediumEditor, a

按钮名称必须唯一,并且不能是MediumEditor中已包含的按钮之一,

button of the same name as one of the standard button in Medium Editor will not override that button

与Medium Editor中的标准按钮之一同名的按钮不会覆盖该按钮

if it is also included.

如果还包括在内。

I do not know what the effects of custom characters in the name will be.

我不知道名称中自定义字符会产生什么影响。

Please report any bugs and I will look into adding something to clean up characters or find some other work-around for any that cause errors.

请报告所有错误,我将研究添加一些内容以清理字符或为导致错误的内容找到其他解决方法。

Label: This is the label that will appear in the button bar.

标签 :这是将显示在按钮栏中的标签。

This field allows HTML.

该字段允许HTML。

Please make sure it is valid html (I do not validate the html you enter).

请确保它是有效的html(我不验证您输入的html)。

Invalid markup will probably

无效的标记可能会

break the button bar or the entire admin.

中断按钮栏或整个管理员。

MediumButton also supports using icons for buttons.

MediumButton还支持将图标用于按钮。

If you want to use icons in your buttons then it is your responsibility to make sure the icon font set is

如果要在按钮中使用图标,则有责任确保图标字体设置为

available for use in the admin of your site.

可在您网站的管理员中使用。

HTML Tag: Enter the html tag that will be inserted by this button.

HTML标记 :输入此按钮将插入的html标记。

Only non-empty html tags are allowed.

仅允许使用非空的html标签。

Most valid HTML tags are supported.

支持大多数有效的HTML标记。

If an invalid HTML tag is entered then the button will be ignored.

如果输入了无效的HTML标签,则该按钮将被忽略。

I’m not sure at this time what effect some of the tags will have in the editor.

目前我不确定某些标记在编辑器中会产生什么影响。

I haven’t tried them all

我还没有尝试全部

if you run into issues let me know and I’ll need to make a decision on wheter to try to fix it or remove

如果您遇到问题,请告诉我,我需要决定是否解决或删除

the tag(s) from the allowed list.

允许列表中的标签。

The currently supported tags are: abbr, acronym, address, article, asside, b,

当前支持的标签是:abbr,首字母缩写词,地址,文章,side,b,

bdi, bdo, blockquote, button, caption, cite, code, del, details, dfn,

bdi,bdo,blockquote,按钮,标题,引用,代码,del,详细信息,dfn,

div, em, footer, h1, h2, h3, h4, h5, h6, header,

div,em,footer,h1,h2,h3,h4,h5,h6,页眉,

i, ins, main, mark, meta, p, pre, q, s, samp, section, small, span,

i,ins,main,mark,meta,p,pre,q,s,samp,section,small,span,

strong, sub, sup, summary, time, u, var, wbr

强,子,sup,摘要,时间,u,var,wbr

Attributes: Add attributes to the html tag.

属性 :将属性添加到html标记。

Attibute names must be valid (they must

姓名名称必须有效(必须

begin with a letter and contain only letter, numbers, underscores and dashes.

以字母开头,并且仅包含字母,数字,下划线和破折号。

Attribute

属性

values must not contain double quotes (“) any attributes that do not conform to these

值不得包含双引号(“)与这些不符的任何属性

rules will be ignored.

规则将被忽略。

Please note that beyond this, attribute names and values are not

请注意,除此之外,属性名称和值不是

validated.

已验证。

I do not know what effect invalid entries will have on your admin.

我不知道无效条目将对您的管理员产生什么影响。

Like other

像其他

values, if you find something that causes an issue, open one and I’ll see what needs to be done.

值,如果您发现导致问题的原因,请打开一个,然后我将查看需要执行的操作。

Other MediumEditor Options: This is a selection of other

其他MediumEditor选项:这是其他
的选择

Core Options available for

核心选项可用于

MediumEditor with the exception of allowBreakInSingleLineInput (see below).

MediumEditor,但 allowBreakInSingleLineInput 除外(请参见下文)。

Please


see the MediumEditor documentation for information on each of the other options.

有关其他每个选项的信息,请参见MediumEditor文档。

Selecting

选择

an option will set that option’s value to true, unselecting the value will set it to false.

一个选项会将该选项的值设置为true,取消选择该值会将其设置为false。

allowBreakInSingleLineInput: This is an option added specifically for use with WP.

allowBreakInSingleLineInput: :这是专门为WP使用而添加的选项。

If you set disableReturn on then the medium editor acts like a single line input field.

如果将disableReturn设置为on,则媒体编辑器的行为就像单行输入字段。

Setting

设置

allowBreakInSingleLineInput allows editors to manually type in
tags into these

allowBreakInSingleLineInput允许编辑者在这些标签中手动输入
标记

single line fields to create line breaks.

单行字段以创建换行符。

Medium Editor Theme

中型编辑器主题

MediumEditor fields will use the WordPress theme created specifically for the this plugin unless you change it.

MediumEditor字段将使用专门为此插件创建的WordPress主题,除非您对其进行更改。

You can alter the theme used for all MediumEditor fields, this is not something that you can apply to only

您可以更改用于所有MediumEditor字段的主题,这不是您只能应用于的主题

some fields.

一些领域。

You can change the theme on your site in one of two ways:

您可以通过以下两种方式之一来更改网站上的主题:

1) wp-config.php

1)wp-config.php

Add the following code to your wp-cofig.php file

将以下代码添加到您的wp-cofig.php文件中

define('MEDIUM_EDITOR_THEME', 'beagle');

  define('MEDIUM_EDITOR_THEME','beagle');

2) filter

2)过滤器

Add the following code to your functions.php file or wherever you would add such a filter

将以下代码添加到您的functions.php文件中,或将添加此类过滤器的任何地方

add_filter('medium-editor-theme', 'my_medium_editor_theme_function');

  add_filter('medium-editor-theme','my_medium_editor_theme_function');

function my_medium_editor_theme_function($theme) {  

函数my_medium_editor_theme_function($ theme){  

$theme = 'beagle';  

$ theme ='beagle';  

return $theme;

返回$ theme;

}

}

Theme name in the above code is one of the following themes currently supported by MediumEditor:

上面的代码中的主题名称是MediumEditor当前支持的以下主题之一:

beagle, bootstrap, default, flat, mani, roman, tim

beagle,bootstrap,default,flat,mani,roman,tim

For more information see MediumEditor and

有关更多信息,请参见 MediumEditor

MediumButton

MediumButton

Custom Editor Styles

自定义编辑器样式

The styles used in the medium editor for elementa is inherited from WP.

在elementa的媒体编辑器中使用的样式是从WP继承的。

If you want to override these styles

如果要覆盖这些样式

create a file named “medium-editor-syle.css” in your theme folder.

在主题文件夹中创建一个名为“ medium-editor-syle.css”的文件。

If this file exists is will be

如果该文件存在,将是

automatcially enqueued on all pages where ACF fields appear.

自动出现在所有显示ACF字段的页面上。

Add Custom Buttons in Code

在代码中添加自定义按钮

This filter is applied to the custom buttons before they are validated as having all the correct

在确认所有自定义按钮正确无误后,此过滤器将应用于自定义按钮

requirements that are given when creating a custom button in the field settings for a Medium Editor Field.

在“中型编辑器”字段的字段设置中创建自定义按钮时给出的要求。

Hooks

挂钩

    1. acf/medium-editor-field/custom-buttons – filter for every field
    2. acf / medium-editor-field / custom-buttons –过滤每个字段

    3. acf/medium-editor-field/custom-buttonsame={$field_name} – filter for specific field based on it’s name
    4. acf / medium-editor-field / custom-buttons / name = {$ field_name} –根据名称过滤特定字段

    5. acf/medium-editor-field/custom-buttons/key={$field_key} – filter for specific field based on it’s key
    6. acf / medium-editor-field / custom-buttons / key = {$ field_key} –根据其关键字过滤特定字段

    Parameters

    参数

      1. $buttons – an array of button options
      2. $ buttons –一系列按钮选项

      3. $field – an array containing all the fields settings for the field being loaded

        $ field –包含要加载的字段的所有字段设置的数组

        // functions.php

        // functions.php

        function my_custom_buttons($buttons, $field) {
          

        function my_custom_buttons($ buttons,$ field){
          

        $buttons[] = array(
            

        $ buttons [] = array(
            

        ‘name’ => ‘red’,
            

        ‘名称’=>‘红色’,
            

        ‘label’ => ‘Red”‘,
            

        ‘label’=>‘Red’’,
            

        ‘attributes’ => array(
              

        ‘attributes’=> array(
              

        ‘name’ => ‘style’,
              

        ‘名称’=>‘样式’,
              

        ‘value’ => ‘color: #F00;’
            

        ‘value’=>‘color:#F00;’
            

        )
          


          

        );
          

        );
          

        return $buttons;

        返回$ buttons;

        }

        }

        add_filter(‘acf/medium-editor-field/custom-buttons’, ‘my_custom_buttons’, 10, 2);

        add_filter('acf / medium-editor-field / custom-buttons','my_custom_buttons',10,2);

      Filter Buttons

      过滤器按钮

      This filter is applied to the list of buttons that will be shown.

      此过滤器将应用于将显示的按钮列表。

      This list will contain the “name”

      该列表将包含“名称”

      of each standard button as well as the “name” of each custom button that has been set up for the field.

      每个标准按钮的名称以及为该字段设置的每个自定义按钮的名称。

      Please note that only valid button names can be used here.

      请注意,此处只能使用有效的按钮名称。

      See medium editor’s list of available

      查看中级编辑的可用列表

      buttons.

      按钮。

      Hooks

      挂钩

        1. acf/medium-editor-field/buttons – filter for every field
        2. acf / medium-editor-field / buttons –过滤每个字段

        3. acf/medium-editor-field/buttonsame={$field_name} – filter for specific field based on it’s name
        4. acf / medium-editor-field / buttons / name = {$ field_name} –根据字段名称过滤特定字段

        5. acf/medium-editor-field/buttons/key={$field_key} – filter for specific field based on it’s key
        6. acf / medium-editor-field / buttons / key = {$ field_key} –根据其键过滤特定字段

        Parameters

        参数

          1. $buttons – an array of button options
          2. $ buttons –一系列按钮选项

          3. $field – an array containing all the fields settings for the field being loaded

            $ field –包含要加载的字段的所有字段设置的数组

            // functions.php

            // functions.php

            function my_custom_buttons($buttons, $field) {
              

            function my_custom_buttons($ buttons,$ field){
              

            // add underline button to all medium editor fields
              

            //将下划线按钮添加到所有中型编辑器字段中
              

            // set both the index and the value of the array element
              

            //设置数组元素的索引和值
              

            if (!isset($buttons[‘underline’])) {
                

            if(!isset($ buttons [‘underline’])){
                

            $buttons[‘underline’] = ‘underline’;
              

            $ buttons [‘underline’] =‘underline’;
              

            }
              

            }
              

            // unset strikethrough if it is set
                

            //未设置删除线(如果已设置)
                

            if (isset($buttons[‘strikethrough’])) {
                

            if(isset($ buttons [‘strikethrough’])){
                

            unset($buttons[‘strikethrough’]);
              

            unset($ buttons [‘strikethrough’]);
              

            }
              

            }
              

            return $buttons;

            返回$ buttons;

            }

            }

            add_filter(‘acf/medium-editor-field/buttons’, ‘my_buttons’, 10, 2);

            add_filter('acf / medium-editor-field / buttons,'my_buttons',10,2);

安装步骤

    1. Copy the acf-medium-editor folder into your wp-content/plugins folder
    2. acf-medium-editor 文件夹复制到您的 wp-content / plugins 文件夹

    3. Activate the Medium Editor Field plugin via the plugins admin page
    4. 通过插件管理页面激活“中型编辑器字段”插件

    5. Create a new field via ACF and select the Medium Editor Field type
    6. 通过ACF创建一个新字段,然后选择“中型编辑器”字段类型

    7. Please refer to the description for more info regarding the field type settings
    8. 有关字段类型设置的更多信息,请参阅说明

下载地址

https://downloads.wordpress.org/plugin/acf-medium-editor-field.2.5.3.zip

https://downloads.wordpress.org/plugin/acf-medium-editor-field.2.5.3.zip

-EOF-

AI助手支持GPT4.0