开源项目920富文本编辑器
2018-03-15 22:09
239 查看
TextEditor文本编辑器
前言
该富文本编辑器: 内核使用的是ace(https://githup.com/ajaxorg/ace) , 所以编译该项目需要先编辑ace内核。前提: 先安装 node node.js npm
方法:
cd tools/assets/ace/
node ./Makefile.dryice.js
常出现的问题:
会出现一些问题: 比如Modules thow error . 可以查看(https://github.com/nodejs/help/issues/663) 进行解决。
整体结构
服务器代码位置: origin git://192.168.0.185/TextEditor.git项目工程(app)
ui包
编辑器的主要界面的搭建。
file_explore
文件浏览module用于打开/另存为/保存时,文件存储位置的浏览.
common
styles
这两个module主要是一些辅助。
核心代码
assets资源文件夹ace文件夹
ace内核
这里都是js的文件
css
文本编辑区的样式
这部分核心编辑区的开发需要web的知识。
功能需求
这个主要还是原项目的内容原项目: https://github.com/jecelyin/920-text-editor-v2
项目逻辑代码分析
EditAreaView.java富文本编辑器的实现都是通过extends WebView.
基础配置如下:
WebSettings ws = getSettings(); ws.setDefaultZoom(WebSettings.ZoomDensity.FAR); ws.setAllowContentAccess(true); ws.setAllowFileAccess(true); ws.setBuiltInZoomControls(false); ws.setDefaultTextEncodingName("utf-8"); ws.setDisplayZoomControls(false); ws.setSupportZoom(false); ws.setLoadWithOverviewMode(false); ws.setJavaScriptEnabled(true); ws.setAppCacheEnabled(false); ws.setDomStorageEnabled(true); ws.setAppCacheMaxSize(1024 * 1024 * 80); ws.setAppCachePath(context.getCacheDir().getPath()); //ws.setAllowFileAccess(true); ws.setCacheMode(WebSettings.LOAD_DEFAULT); addJavascriptInterface(new JavascriptApi(), "AndroidEditor");//交互接口AndroidEditor setWebViewClient(new EditorViewClient()); setWebChromeClient(new EditorViewChromeClient());
InputConnectionHacker.java
该类 implements InputConnection
InputConnection.java- 用于文本输入的接口
openthos 系统中在InputConnection中添加了 isLauncherFocus(boolean isFocus)方法
在InputConnectionHacker中也需要实现该方法;
MenuDialog.java
顶部菜单的dialog实现
TabManager.java
implements TabViewPager.OnPageChangeListener
对编辑栏的增加
TabAdapter.java
extends RecyclerView.Adapter
实现布局的
针对js和java之间的调用
bridge.jsAndroidEditor.onScrollStart();
EditAreaView.java
@JavascriptInterface
public void onScrollStart() {
……
}
函数名一致进行 transmit.
相关文章推荐
- [android] 开源项目研究.md
- 开源项目导入eclipse的一般步骤
- ReactNative 开源项目 --仿优购商城
- 许多VC++/MFC构架的开源项目
- 【自动化测试】无需图形界面环境下的浏览器开源项目
- [开源项目]Shell4Win,一个在Windows下执行shell命令的解释器
- .Net 开源项目资源大全
- 再看知名应用背后的第三方开源项目
- (4.2.2.1)【android开源工具】【Android UI设计与开发】第16期:滑动菜单栏(一)开源项目SlidingMenu的使用
- 从0开始学习 GitHub 系列之「08.如何发现优秀的开源项目」
- GitHub 优秀的 Android 开源项目
- Android开源项目发现---GridView 篇(持续更新)
- 开源项目Coding学习笔记(1):EaseStartView --- 第一个界面
- C#第五次作业:开源项目“网页正文提取”的理解
- 开源项目管理系统:MyCollab
- Android开源项目发现--- 工具类网络相关篇(持续更新)
- 【xbin-store】基于springboot的分布式B2C电商开源项目
- Restful.Data 开源持久层组件项目最新进展和使用说明
- 开源项目介绍