Giter Site home page Giter Site logo

capricorncd / zx-editor Goto Github PK

View Code? Open in Web Editor NEW
330.0 12.0 100.0 4.11 MB

The HTML document (rich text) editor in Smart phone browser or webview, supporting mixed layout, reference, headline, unordered list, font color, bold and italics. 移动端HTML文档(富文本)编辑器,支持图文混排、引用、大标题、无序列表,字体颜色、加粗、斜体

Home Page: https://capricorncd.github.io/zx-editor/demo

JavaScript 38.74% Shell 0.18% TypeScript 43.56% SCSS 5.12% HTML 5.74% CSS 5.55% PHP 1.11%
editor html5 smart-phone npm-workspaces typescript

zx-editor's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zx-editor's Issues

使用3.0.2版本出现的问题

我是在Vue单页面应用中当做子组件来使用的,通过import ZxEditor from 'zx-editor';来引入。
问题:
1.页面显示异常,编辑器的高度默认设置的很高,底部工具栏会始终显示
image
2.点击编辑框会默认选择图片
image
请问大佬如何处理

npm run build 为什么只有首次会生成

我执行npm run build
在dist文件夹中只有首次会生成zx-editor.css zx-editor-min.css zx-editor.css

以后执行npm run build在dist文件只会生成zx-editor-min.js

这是为什么呢?

手机浏览器兼容问题

测试了微信自带浏览器、UC浏览器、oppo自带浏览器均无问题,但是我本人的努比亚自带浏览器,有一些问题,首先点击返回按钮可以,但是上传图片无反应,debug无信息,下方按钮均无反应,再虚拟键盘弹出时,点击文字样式可以弹出但是会闪退,虚拟键盘也会打开。

可以支持自定义DOM标签吗

目前是使用的section,但是和之前已有的项目无法兼容,可以满足支持自定义p标签或者是div标签吗?

老哥,出出出大BUG啦

用谷歌浏览器打开F12调试发现没有问题,然后用手机微信打开,发现点击文本框并不会弹出键盘,看了一下,是因为我使用了ydui.js这个插件导致的,里面使用了FastClick这个防止300秒延迟的东东,辣么问题来了,,有神马方法可以兼容这个东西吗?
我在其他页面使用过禁用FastClick这个东东的方法,不知道在这里可行否?
下面代码:
var notNeed = FastClick.notNeeded(document.body);
$.fn.triggerFastClick=function(){
this.trigger("click");
if(!notNeed){
this.trigger("click");
}
}

编译失败

D:\Projects\zx-editor\node_modules\webpack-cli\bin\config-yargs.js:89
                                describe: optionsSchema.definitions.output.properties.path.description,
                                                                           ^
TypeError: Cannot read property 'properties' of undefined
    at module.exports (D:\Projects\zx-editor\node_modules\webpack-cli\bin\config-yargs.js:89:48)
    at Object.<anonymous> (D:\Projects\zx-editor\node_modules\webpack-dev-server\bin\webpack-dev-server.js:84:40)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:279:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:752:3)

需要更新依赖到以下版本:
"webpack": "^4.20.2",
"webpack-cli": "^3.1.1"

链接功能在手机上点击链接不反应

在电脑上需要鼠标点击移动错位才生效,点击也是不反应的,如果我想上传一个word文档链接都打不开在手机上,实用性就不高了,为什么要这样设计啊

解决图片file格式上传服务器

我也是要上传到服务器再返回来img的文件路径
我的思路是:点击发送的时候获取编辑器里面全部的base64位图片再转为file文件
直接贴源码吧,我这边要上传获取到的img信息的数组所以每次点击发送都会清空newList,希望对大家有帮助
zxEditor.on('finishButton', function () {
var newList=[];
for (var i = 0; i < that.data.imgList.length; i++) {
var li = that.data.imgList[i];
$(".child-node-is-img img").each(function (index, ele) {
if (ele.id == li.file_name.substr(0, li.file_name.length - 4)) {
newList.push(that.data.imgList[i]);
}
})
}
var list = zxEditor.getBase64Images();
function dataURLtoFile(dataurl, filename) {
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr], filename, { type: mime });
}
for (var i = 0; i < list.length; i++) {
var item = list[i];
upimgData(1, dataURLtoFile(item.base64, item.id + ".jpg"), function (res) {
var id = res.data.file_name.substr(0, res.data.file_name.length - 4);
$(".zxeditor-content-wrapper").find("#" + id).attr("src", res.data.url);
// 判断图片之前是否存在
// 不存在则追加
newList.push(res.data);
})
}
that.data.imgList = newList;
// 获取编辑器里面的内容
that.data.textContent = zxEditor.getContent();
console.log(that.data.imgList);
console.log(that.data.textContent);
})

【未压缩文件BUG】

html引入min.js正常,但引入zx-editor.js报错:Uncaught TypeError: ZxEditor is not a constructor

上传多张图片bug

上传多张图片问题
TypeError: null is not an object (evaluating 'i.getContext("2d").drawImage')filename

复制粘贴问题

只要复制内容不是纯文本, 都不能粘贴
举例: 在demo里面打几个字, 然后全选剪切, 并不能粘贴
看了一下源码, getPasteText里, items的getAsString是空, 不是很熟, 本人也没能力修复.

你好 问一下 ,这里的监听 为啥不会打印

zxEditor.on('select-picture', function (_) {
// hybrid模式开发时,此处可以调用原生App提供的接口,访问图片文件选择列表
// 执行图片文件数据获取,
// 或者获取由原生App处理并上传完成的图片url
console.log("自定义选择图片-------------------");
zxEditor.addImage('图片url地址或base64图片数据')
// 其他操作...
})

H5项目中使用编辑器上传图片或者拍照,照片被逆时针旋转90度

同一个项目,app中因为自定义了上传图片和拍照的方法所以没出现上传图片被旋转90度的问题,但移到H5项目中,自定义的方法没用,就用编辑器自带的上传图片功能,可是在苹果手机和部分安卓手机上使用,拍照都被逆时针旋转了90度,选择相册图片时有的图也会被旋转,不知道什么原因,应该在哪里做修改。希望遇到该问题的朋友们能指点下,感谢~

change事件问题

目前修改当前内容样式的时候 比如颜色大小时候 不会触发change事件

Vue单页应用中的bug

/**

  • 初始化
  • @param selector
  • @param options
  • @Private
    */
    _init (selector, options) {
    // version
    this.version = 'VERSION'
    // broadcast
    this.broadcast = broadcast.broadcast
    this.broadcast = broadcast.broadcast 在单页应用中会重复
    单页应用中A跳转到B页面(在monted钩子里 new ZxEditor 一个对象),这时B返回A,A再跳转到B ,这样broadcast.broadcast并不是最初的对象,并没有初始化而是使用了之前的对象,导致select-picture会绑定多个事件,
    this.zxEditor.on('select-picture', function () {
    // 会多次触发这个事件,跳转多少次就会触发多少次
    $inputFile.click();
    })

为什么 this.broadcast = broadcast.broadcast 这里不直接用this.broadcast = {} 这样初始化呢?

git动图处理

直接显示不裁剪及转码处理
可选gif文件大小限制配置
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.