Security News
Supply Chain Attack Detected in @solana/web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@zhike/queen-editor
Advanced tools
一个易于二次开发、与业务解耦的编辑器。
(待完善)
npm install @zhike/queen-editor
// App.css
.editor-toolbar-contaienr {
height: 40px;
width: 100%;
border: 1px solid rgba(0, 0, 0, 0.08);
display: flex;
justify-content: center;
align-items: center;
}
.editor-text-container {
border-radius: 4px;
box-shadow: -3px -3px 10px rgba(0, 0, 0, 0.06), 3px 3px 10px rgba(0, 0, 0, 0.06);
margin: 24px auto;
width: 666px;
background-color: white;
}
// App.js
import React, { useRef, useEffect } from 'react'
import ReactDOM from 'react-dom';
import E from '@zhike/queen-editor'
import './App.css'
const App = () => {
const editorInstance = useRef()
useEffect(() => {
editorInstance.current = new E('#toolbar-container', '#text-container')
const editor = editorInstance.current
editor.config.onchange = newHtml => console.log('onChange', newHtml)
editor.config.minHeight = '128vh'
editor.create()
editor.txt.html('<p>this is test insert</p>')
}, [])
return (
<div>
<div class="editor-toolbar-contaienr">
<div id="toolbar-container"></div>
</div>
<div class="editor-text-container">
<div id="text-container"></div>
</div>
</div>
)
}
ReactDOM.render(<App />, document.getElementById('root'));
(待完善)
使用webpack-devserver的方式调试
npm install
npm run start
# 浏览器访问 http://localhost:7077/
使用node server的方式调试
如果调试编辑器上传文件功能,在local起一个服务器会比较方便一点
npm install
npm run start:service
# 浏览器访问 http://127.0.0.1:7777/dist/index.html
// 辅助命令 查看7777端口是否已经被进程占用
lsof -i :7777
// 辅助命令 关闭占用7777端口的<pid>号进程
kill <pid>
master
发包分支,仅在此分支才能进行发包操作(🈲️在此分支开发)develop
开发分支,用来合并开发人员的分支 (🈲️在此分支开发)feature/\<name\>
开发人员的分支(待优化)
目前有三种分支
创建feature/xxx分支进行个人开发
git checkout develop
git checkout -b feature/xxx
将feature/xxx合并到develop分支并是部署
// 本地git操作
// ... 在feature/xxx进行commit操作 ...
git checkout master
git pull origin master
git checkout develop
git merge master // 处理develop和master版本号不同问题
git pull origin develop
git checkout feature/tj
git merge develop // 本地处理feature/xxx和develop分支冲突
git push origin feature/xxx
// 在gitlab pull request 并merge到develop
发包
可以执行npm run try-release
体验发包流程,以下代码是正式发包流程
git checkout develop
git pull origin develop
git checkout master
git merge develop
npm run release
tips:
不要在master
上开发,原则上master
的改动都来自于merge develop
npm run release
会帮开发人员检查是否有未提交的修改,只有所有修改都提交了,才能发包。
npm run release
会自动创建一个带版本号的commit,并提交到master分支上。
typescript
、less
webpack
开发相关目录
src
编辑器代码build
webpack配置server
服务端,主要用于调试资源上传功能dist
开发调试目录、打包产物目录、npm包发布目录src目录
assets
存放样式字体文件config
编辑器默认配置editor
编辑器核心功能
index.ts
编辑器入口文件init-fns/
编辑器初始化功能command.ts
document.exeCommand封装selection.ts
封装Selection和Rangelib/
用到的第三方库menus/
菜单栏和菜单
index.ts
菜单栏classmenus-constructor/
生成单个菜单所用到的classmenu-list.ts
汇总所有的菜单text/
文本编辑区域
index.ts
入口文件,产出class, 封装单个API。event-hooks/
初始化text的各个钩子函数,如回车、删除、黏贴等paste/
处理黏贴事件utils
工具
observer/
文本区域内容比变化监听器const.ts
常量dom-core.ts
封装简单jq,进行dom操作util.ts
各个工具函数配置相关目录
这里倾向于把devDependencies中需要配置的包的配置,单独写成配置文件放在项目根目录下。
.husky
husky配置(precommit阶段检查代码格式).release-it.js
npm发包配置.sh
自定义shell脚本 (检查发包前工作目录是否干净).eslintrc.js
、.eslintignore
eslint配置.gitlab-ci.yml
、deploy
线上部署配置.vscode
vscode配置wangEditor (respect
)
FAQs
queen-editor
The npm package @zhike/queen-editor receives a total of 0 weekly downloads. As such, @zhike/queen-editor popularity was classified as not popular.
We found that @zhike/queen-editor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.