feat: add featured title tool

pull/155/head
Seaton Jiang 2020-02-26 22:30:52 +08:00
parent 29b82515f1
commit 9da2e813e3
5 changed files with 42 additions and 8 deletions

View File

@ -607,9 +607,9 @@ button:focus {
margin-bottom: 10px; margin-bottom: 10px;
} }
.k-main .board .article-panel .a-post.a-none .content{ .k-main .board .article-panel .a-post.a-none .content {
margin-bottom: 0; margin-bottom: 0;
} }
.k-main .board .article-panel .a-meta { .k-main .board .article-panel .a-meta {
padding: 5px 12px; padding: 5px 12px;
@ -716,6 +716,15 @@ button:focus {
font-size: 24px; font-size: 24px;
} }
.k-main .details .article .content h2.title {
font-size: 20px;
padding: 0 10px;
border-left: 5px solid #00a2ff;
background-color: rgba(243,243,243,.7);
line-height: 41px;
margin: 16px -16px;
}
.k-main .details .article .content h3 { .k-main .details .article .content h3 {
font-size: 20px; font-size: 20px;
} }
@ -733,7 +742,7 @@ button:focus {
} }
.k-main .details .article .content p { .k-main .details .article .content p {
color: #4a4a4a; color: #151515;
white-space: pre-line; white-space: pre-line;
line-height: 30px; line-height: 30px;
} }

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 B

View File

@ -1,4 +1,20 @@
(function() { (function() {
tinymce.create('tinymce.plugins.h2title', {
init : function(ed, url) {
ed.addButton('h2title', {
title : '特色标题',
image : url+'/images/title.png',
onclick : function() {
ed.selection.setContent('[h2title]' + ed.selection.getContent() + '[/h2title]');
}
});
},
createControl : function(n, cm) {
return null;
},
});
tinymce.PluginManager.add('h2title', tinymce.plugins.h2title);
tinymce.create('tinymce.plugins.success', { tinymce.create('tinymce.plugins.success', {
init : function(ed, url) { init : function(ed, url) {
ed.addButton('success', { ed.addButton('success', {

View File

@ -3,9 +3,18 @@
* 文章短代码 * 文章短代码
* @author Seaton Jiang <seaton@vtrois.com> * @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License * @license MIT License
* @version 2020.02.15 * @version 2020.02.26
*/ */
function h2title($atts, $content = null, $code = "")
{
$return = '<h2 class="title">';
$return .= $content;
$return .= '</h2>';
return $return;
}
add_shortcode('h2title', 'h2title');
function success($atts, $content = null, $code = "") function success($atts, $content = null, $code = "")
{ {
$return = '<div class="alert alert-success">'; $return = '<div class="alert alert-success">';
@ -183,6 +192,7 @@ function more_button()
function register_button($buttons) function register_button($buttons)
{ {
array_push($buttons, " ", "h2title");
array_push($buttons, " ", "kbd"); array_push($buttons, " ", "kbd");
array_push($buttons, " ", "mark"); array_push($buttons, " ", "mark");
array_push($buttons, " ", "striped"); array_push($buttons, " ", "striped");
@ -195,7 +205,6 @@ function register_button($buttons)
array_push($buttons, " ", "info"); array_push($buttons, " ", "info");
array_push($buttons, " ", "warning"); array_push($buttons, " ", "warning");
array_push($buttons, " ", "danger"); array_push($buttons, " ", "danger");
array_push($buttons, " ", "successbox"); array_push($buttons, " ", "successbox");
array_push($buttons, " ", "infoboxs"); array_push($buttons, " ", "infoboxs");
array_push($buttons, " ", "warningbox"); array_push($buttons, " ", "warningbox");
@ -205,6 +214,7 @@ function register_button($buttons)
function add_plugin($plugin_array) function add_plugin($plugin_array)
{ {
$plugin_array['h2title'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js';
$plugin_array['kbd'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js'; $plugin_array['kbd'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js';
$plugin_array['mark'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js'; $plugin_array['mark'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js';
$plugin_array['striped'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js'; $plugin_array['striped'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js';
@ -217,7 +227,6 @@ function add_plugin($plugin_array)
$plugin_array['info'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js'; $plugin_array['info'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js';
$plugin_array['warning'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js'; $plugin_array['warning'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js';
$plugin_array['danger'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js'; $plugin_array['danger'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js';
$plugin_array['successbox'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js'; $plugin_array['successbox'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js';
$plugin_array['infoboxs'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js'; $plugin_array['infoboxs'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js';
$plugin_array['warningbox'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js'; $plugin_array['warningbox'] = get_bloginfo('template_url') . '/assets/js/buttons/more.js';