适配编辑器

This commit is contained in:
taoser 2023-04-23 10:36:27 +08:00
parent 94bf95951e
commit 12ad13a7f8
7 changed files with 520 additions and 491 deletions

View File

@ -9,7 +9,6 @@
<form class="layui-form" action="">
<div class="mainBox">
<div class="main-container">
<div class="layui-row layui-col-space15 layui-form-item">
<div class="layui-col-md3">
<label class="layui-form-label">{:lang('special column')}</label>
@ -71,9 +70,7 @@
<div id="tag"></div>
</div>
</div>
</div>
</div>
<div class="bottom">
<div class="button-container">
@ -90,24 +87,9 @@
</form>
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
<script src="/static/jquery-3.6.0.min.js"></script>
<script src="/static/addons/taonyeditor/tinymce/tinymce.min.js"></script>
<script src="/static/addons/taonyeditor/tinymce/tinymce-jquery.min.js"></script>
<script>
//定义选择器
var mytextareaid = 'textarea#L_content';
var imagePrependUrl = "{$domain}";
//定义文件上传接口接口
var taonyUploadUrl = "{:url('content.forum/uploads')}",
taonyUploadImgage = "{:url('content.forum/uploads')}?type=image",
taonyUploadVideo = "{:url('content.forum/uploads')}?type=video";
taonyUploadZip = "{:url('content.forum/uploads')}?type=zip";
taonyUploadAudio = "{:url('content.forum/uploads')}?type=audio";
$(mytextareaid).removeClass();
</script>
<script src="/static/xm-select.js"></script>
<script>
layui.extend({
editor: '{/}/static/addons/taonyeditor/js/taonyeditor'
@ -116,27 +98,15 @@
var editor = layui.editor;
var xmSelect = layui.xmSelect;
// var tinymce = layui.tinymce
// var edit = tinymce.render({
// elem: "#L_content",
// height: 400
// });
editor.render({
selector: 'textarea#L_content',
uploadUrl: "{:url('content.forum/uploads')}",
imagePrependUrl: "{$domain}"
});
//获取百度标签标志tag或者word;
var flag = 'word';
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
var taonystatus = "{:hook('taonystatus')}";
// 编辑器插件启用状态
var isShow = taonystatus ? false : true;
if(isShow) {
$('.layui-textarea').each(function(){
var othis = $(this), html = othis.html();
othis.attr(fly.content(html));
})
}
// 从详情页自动调用端口过滤,获取描述信息
tinymce.get('L_content').on('mouseleave', function() {
var content = tinymce.get('L_content').getContent({format: 'text'});

View File

@ -9,7 +9,6 @@
<form class="layui-form" action="">
<div class="mainBox">
<div class="main-container">
<input type="hidden" name="id" value="{$article.id}">
<div class="layui-row layui-col-space15 layui-form-item">
<div class="layui-col-md3">
@ -36,7 +35,6 @@
<div id="test9" style="margin-left: 30px;"></div>
</div>
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
<textarea id="L_content" name="content" required lay-verify="required" placeholder="详细内容" class="layui-textarea fly-editor" style="height: 260px;">{$article.content}</textarea>
@ -74,14 +72,11 @@
<div class="layui-form-item layui-hide">
<button type="submit" class="layui-btn" lay-filter="article-edit" lay-submit id="article-edit">{:lang('post now')}</button>
</div>
</div>
</div>
<div class="bottom">
<div class="button-container">
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="user-save">
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="forum-save">
<i class="layui-icon layui-icon-ok"></i>
提交
</button>
@ -94,27 +89,12 @@
</form>
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
<script src="/static/jquery-3.6.0.min.js"></script>
<script src="/static/addons/taonyeditor/tinymce/tinymce.min.js"></script>
<script src="/static/addons/taonyeditor/tinymce/tinymce-jquery.min.js"></script>
<script>
//定义选择器
var mytextareaid = 'textarea#L_content';
var imagePrependUrl = "{$domain}";
//定义文件上传接口接口
var taonyUploadUrl = "{:url('content.forum/uploads')}",
taonyUploadImgage = "{:url('content.forum/uploads')}?type=image",
taonyUploadVideo = "{:url('content.forum/uploads')}?type=video";
taonyUploadZip = "{:url('content.forum/uploads')}?type=zip";
taonyUploadAudio = "{:url('content.forum/uploads')}?type=audio";
$(mytextareaid).removeClass();
</script>
<script src="/static/xm-select.js"></script>
<script>
layui.extend({
index: 'lib/index' //主入口模块
,editor: '{/}/static/addons/taonyeditor/js/taonyeditor'
editor: '{/}/static/addons/taonyeditor/js/taonyeditor'
}).use(['colorpicker','form','upload', 'editor'], function(){
var $ = layui.jquery
,colorpicker = layui.colorpicker
@ -123,6 +103,13 @@
var artId = "{$article.id}";
var editor = layui.editor;
// 初始化编辑器
editor.render({
selector: 'textarea#L_content',
uploadUrl: "{:url('content.forum/uploads')}",
imagePrependUrl: "{$domain}"
});
$(function(){
//1.渲染标签
var addTags = xmSelect.render({
@ -231,6 +218,34 @@
}
});
form.on('submit(forum-save)', function(data) {
$.ajax({
url: "{:url('content.forum/edit')}",
data: JSON.stringify(data.field),
dataType: 'json',
contentType: 'application/json',
type: 'post',
success: function(result) {
if (result.code === 0) {
layer.msg(result.msg, {
icon: 1,
time: 1000
}, function() {
parent.layer.close(parent.layer.getFrameIndex(window
.name)); //关闭当前页
parent.layui.table.reload("user-table");
});
} else {
layer.msg(result.msg, {
icon: 2,
time: 1000
});
}
}
})
return false;
});
});
</script>
</body>

View File

@ -104,18 +104,19 @@
<script>
const FORUM_List = "{:url('content.forum/list')}";
var forumReplys = "{:url('Forum/replys')}",
forumRedel = "{:url('Forum/redel')}",
forumReplysform = "{:url('Forum/replysform')}",
forumTags = "{:url('Forum/tags')}",
forumTagsDelete = "{:url('Forum/tagsdelete')}",
forumTagsForm = "{:url('Forum/tagsform')}";
var forumList = "{:url('content.forum/list')}";
layui.use(['jquery','form', 'table','common'], function(){
layui.use(['toast','jquery','form', 'table','common'], function(){
var $ = layui.jquery
,form = layui.form
,table = layui.table;
let common = layui.common;
var toast = layui.toast;
//如果你是采用模版自带的编辑器,你需要开启以下语句来解析。
var taonystatus = "{:hook('taonystatus')}";
// 编辑器插件启用状态
var isShow = taonystatus ? false : true;
let cols = [
[
@ -207,6 +208,10 @@
});
window.add = function() {
if(isShow) {
toast.info({title: '信息',message: '编辑器插件未开启或未安装',position: 'topRight'});
return false;
}
layer.open({
type: 2,
title: '新增',
@ -217,6 +222,10 @@
}
window.edit = function(obj) {
if(isShow) {
toast.info({title: '信息',message: '编辑器插件未开启或未安装',position: 'topRight'});
return false;
}
layer.open({
type: 2,
title: '修改',

View File

@ -602,7 +602,6 @@
// 升级提醒
$(function (){
console.log(123)
$.get("{:url('system.upgrade/check')}",function (data){
if (data.code === 1) {
//可升级

View File

@ -0,0 +1,22 @@
<!--
* @Author: TaoLer <alipay_tao@qq.com>
* @Date: 2021-12-06 16:04:50
* @LastEditTime: 2022-06-28 10:00:54
* @LastEditors: TaoLer
* @Description: 后台头部结构
* Copyright (c) 2020~2023 https://www.aieok.com All rights reserved.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{block name="title"}TaoLerCMS后台管理系统{/block}</title>
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
</head>
<body>
{block name="body"}内容{/block}
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
{block name="js"}js文件{/block}
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{block name="title"}TaoLerCMS后台管理系统{/block}</title>
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
</head>
<body class="pear-container">
{block name="body"}内容{/block}
<script src="/static/component/layui/layui.js"></script>
<script src="/static/component/pear/pear.js"></script>
{block name="js"}js文件{/block}
</body>
</html>

View File

@ -16,7 +16,7 @@ return [
// 应用名,此项不可更改
'appname' => 'TaoLer',
// 版本配置
'version' => '2.2.3',
'version' => '2.2.4',
// 加盐
'salt' => 'taoler',
// 数据库备份目录