随笔 - 1357  文章 - 0  评论 - 1104  阅读 - 1941万

ueditor编辑器和at.js集成

源码:

复制代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
    //禁止jsp解析${}
%>
<%@ page isELIgnored="true"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <base href="<%=basePath%>">

        <title>at+ueditor整合</title>
        <meta http-equiv="x-ua-compatible" content="IE=Edge" />
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        
        <link href="<%=path %>/css/jquery.atwho.min.css" rel="stylesheet">
        <script src="<%=path%>/js/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript" charset="utf-8" src="<%=path%>/ueditor/ueditor.config.js"></script>
        <script type="text/javascript" charset="utf-8" src="<%=path%>/ueditor/_examples/editor_api.js"></script>
        <script src="<%=path %>/js/jquery.caret.min.js" type="text/javascript"></script>
        <script src="<%=path %>/js/jquery.atwho.min.js" type="text/javascript"></script>
        <style type="text/css">
        .dkhs-edui {
            border: 1px solid #d4d4d4;
        }
        </style>
        <script type="text/javascript">
            $(function(){    
                var at_config = {
                       at: "@",
                    data:['Peter', 'Tom', 'Anne', 'zhangsan', 'lisi', 'wangwu', 'laoliu', 'libai', 'dupu', 'xiaozhou'],
                    limit: 20
                }
                
                var ue = UE.getEditor('mytextarea',{ 
                    contextMenu:[],
                    //focus时自动清空初始化时的内容
                    autoClearinitialContent:true,
                       //关闭字数统计
                    wordCount:false,
                    //关闭elementPath
                    elementPathEnabled:false,
                });    
                
                ue.addListener('ready', function(editor){
                    $("#edui1").removeClass("edui-editor  edui-default").addClass("dkhs-edui");
                    $(this.document.body).atwho(at_config);
                 });
            });
        </script>
        </head>
        <body>
            <textarea id="mytextarea" contenteditable="true">dd</textarea>
        </body>
</html>
复制代码

 

效果如下:

posted on   Ruthless  阅读(3901)  评论(1编辑  收藏  举报
编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 写一个简单的SQL生成工具
· AI 智能体引爆开源社区「GitHub 热点速览」
历史上的今天:
2013-05-28 storm实战入门一
2013-05-28 storm教程
2012-05-28 ibatis 简介
2011-05-28 十二、ContentProvider和Uri详解
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示