Skip to content

Commit

Permalink
1.9.3 update
Browse files Browse the repository at this point in the history
  • Loading branch information
baiy committed Nov 28, 2021
1 parent 15c012d commit b295d0f
Show file tree
Hide file tree
Showing 8 changed files with 1,266 additions and 282 deletions.
23 changes: 8 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@

## chrome 安装

- 方法1: 在 [Chrome 应用商店](https://chrome.google.com/webstore/detail/ipfcebkfhpkjeikaammlkcnalknjahmh) 安装
- 方法2: [下载 .crx 安装包](https://github.com/baiy/Ctool/releases/latest)
- 方法3: [百度网盘下载](https://pan.baidu.com/s/1mhWbqWC) 安装方法和方法2一致

> 方法2 / 方法3 不定期维护 仅供网络环境特别恶劣的同学使用
>
> [猛戳这里查看手动安装`.crx`教程](http://www.cnplugins.com/tool/outline-install-crx-file.html)
-[Chrome 应用商店](https://chrome.google.com/webstore/detail/ipfcebkfhpkjeikaammlkcnalknjahmh) 安装

## 微软 Edge 安装

Expand All @@ -30,9 +24,7 @@

## utools 安装

### 插件中心安装

> 插件中心搜索 `ctool`
- [utools](https://u.tools/) 插件中心 搜索 `ctool`

## 开发

Expand All @@ -54,15 +46,15 @@ npm run build -adapter=[chrome|edge|utools|firefox|web]
|加密/解密|`AES`,`DES`,`RC4`,`Rabbit`,`TripleDes`,`sm2`||
|BASE64编码|`加密`,`解密`,`支持文件`||
|URL编码|`编码`,`解码`||
|时间戳|双向转换||
|时间戳|`双向转换`,`毫秒`||
|二维码|`生成`,`解析`||
|条形码|`生成`||
|汉字转拼音|`声调`,`首字母`,`分隔符`||
|IP地址查询|`运营商`,`城市`|×|
|代码格式化|`js`, `ts`, `html`, `css`, `less`, `scss`, `graphql`, `vue`, `angular`, `markdown`, `json5`, `xml`, `yaml`, `sql`, `压缩`||
|Unicode|`双向转换`,`emoji`,`html 实体`,`css 实体`||
|进制转换|2-64进制互转||
|正则表达式|字符匹配||
|进制转换|`2-64进制`||
|正则表达式|`匹配`,`查找`,`替换`||
|随机字符生成器|`批量`,`特殊字符`||
|序列化转换|`json`, `xml`, `yaml`, `phpArray`, `phpSerialize`, `properties`||
|文本差异化对比|``,`单词`,`css`||
Expand All @@ -78,8 +70,9 @@ npm run build -adapter=[chrome|edge|utools|firefox|web]
|jwt解码|`header`, `payload`||
|Hex/String转换|`hex to string`, `string to hex`, `十六进制转字符串`, `字符串转十六进制`||
|文本处理|`大小写转换`, `中英文标点转换`, `简繁转换`, `替换`, `字符统计`, `行去重`, `添加行号`, `行排序`, `过滤行首尾不可见字符`,`过滤空行`||
|html编码|`html编码`||
|签名/验签|`签名`,`验签`,`RSA`||
|html编码|-||
|原码/反码/补码|`生成`||
|ARM/HEX|`互转`|×|

## 第三方开源库

Expand Down
1,410 changes: 1,186 additions & 224 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "c-tool",
"version": "1.9.2",
"version": "1.9.3",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --port 8081",
Expand All @@ -17,14 +17,15 @@
"babel-runtime": "^6.26.0",
"bignumber.js": "^9.0.1",
"code-formatter": "0.0.1",
"codemirror": "^5.63.3",
"codemirror-graphql": "^1.1.0",
"codemirror": "^5.64.0",
"codemirror-graphql": "^1.2.4",
"cosmiconfig": "^7.0.1",
"cron-parser": "^2.16.3",
"cronstrue": "^1.122.0",
"crypto-js": "^3.3.0",
"diff-match-patch": "^1.0.5",
"file": "^0.2.2",
"graphql": "15.5.0",
"graphql": "15.7.2",
"ipinyinjs": "^1.0.0",
"jian_fan": "^1.0.3",
"jimp": "^0.16.1",
Expand All @@ -35,21 +36,21 @@
"json-to-properties": "^1.1.3",
"json5": "^2.2.0",
"jsonlint": "^1.6.3",
"jsrsasign": "^10.4.1",
"jsrsasign": "^10.5.0",
"jsrsasign-util": "^1.0.5",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"mime-types": "^2.1.34",
"moment": "^2.29.1",
"php-array-reader": "^1.3.2",
"phparr": "^0.2.0",
"postcss": "^8.3.11",
"postcss": "^8.4.4",
"postcss-less": "^5.0.0",
"postcss-scss": "^4.0.2",
"prettier": "^2.4.1",
"prettier": "^2.5.0",
"prettier-plugin-sql": "^0.3.0",
"properties-to-json": "^0.1.7",
"qrcode": "^1.4.4",
"qrcode": "^1.5.0",
"qrcode-parser": "^1.2.0",
"query-string": "^6.14.1",
"serialize-php": "^1.1.2",
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/locales/en/main.i18n.json5
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@
"tool_binary": "trueForm/inverse/complement",
"tool_armConverter": "ARM/HEX",
// other
"css_main_category_item_style": "padding: 0 10px"
"css_main_category_item_style": "padding: 0 10px",
"editor_line_wrapping": "Line Wrapping"
}
13 changes: 7 additions & 6 deletions src/i18n/locales/zh_CN/main.i18n.json5
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,22 @@
"tool_regex": "正则表达式",
"tool_randomString": "随机字符生成",
"tool_serializeConversion": "序列化转换",
"tool_diffs": "文本差异化对比",
"tool_crontab": "crontab校验",
"tool_websocket": "websocket调试",
"tool_diffs": "文本比对",
"tool_crontab": "crontab",
"tool_websocket": "websocket",
"tool_unit": "单位换算",
"tool_time": "时间计算器",
"tool_uuid": "UUID生成",
"tool_jsonToObject": "JSON转实体类",
"tool_ascii": "ASCII转换",
"tool_variableConversion": "变量名转换",
"tool_ascii": "ASCII",
"tool_variableConversion": "变量名",
"tool_jwt": "JWT解码",
"tool_hexString": "Hex/String",
"tool_text": "文本处理",
"tool_html": "Html编码",
"tool_binary": "原码/反码/补码",
"tool_armConverter": "ARM/HEX",
// 其他
"css_main_category_item_style": "padding: 0 20px"
"css_main_category_item_style": "padding: 0 20px",
"editor_line_wrapping": "自动换行"
}
56 changes: 31 additions & 25 deletions src/tool/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,25 @@ const debounceSaveToolDataMethod = _.debounce(function () {
}, 1000)


const appendData = async function (field = "", check = "") {
const appendData = async function (check = "") {
const result = (data = "") => {
if (data){
if (data) {
if (
!check
|| (_.isFunction(check) && check(data)) // 函数校验
){
return field ? {[field]: data} : data
) {
return data
}
}
return field ? {} : ""
return ""
}
return new Promise(async (resolve) => {
try {
// 使用固定输入数据
if (fixeInputData) {
return resolve(result(fixeInputData))
let temp = fixeInputData
fixeInputData = ""
return resolve(result(temp))
}
if (setting.autoReadCopy()) {
let paste = (await clipboard.paste()).trim()
Expand All @@ -87,34 +89,38 @@ export const plugin = {
install: function (Vue) {
Vue.prototype.$initToolData = function (input = "", inputCheck = "", field = "current", isLoadHistory = true) {
let current = _.cloneDeep(this[field])
let inputHistory = ""
let inputDefault = ""
let inputAppend = ""
// 默认数据
if (input && (input in current) && current[input]) {
inputDefault = current[input];
}
// 历史数据
if (isLoadHistory) {
let history = this.$getToolData()
if (input && (input in history)) {
inputHistory = history[input]
delete history[input]
}
Object.assign(current, this.$getToolData())
}

if (!input) {
this[field] = current
return;
}

// 初始化默认值
if (!(input in current)){
current[input] = "";
}

// 保存默认值
let inputDefault = current[input]
current[input] = "";

appendData(input, inputCheck).then((append) => {
for (let key of Object.keys(append)) {
if ((key in current) && !current[key]) {
current[key] = append[key]
// 追加剪贴板等数据
appendData(inputCheck).then((append) => {
inputAppend = append
this[field] = Object.assign(
current,
{
// 历史数据 > 追加数据 > 默认数据
[input]: inputHistory ? inputHistory : (inputAppend ? inputAppend : inputDefault)
}
}
if (!current[input]){
// 使用默认值
current[input] = inputDefault
}
this[field] = current
)
})
}
Vue.prototype.$getToolData = function () {
Expand Down
2 changes: 1 addition & 1 deletion src/views/tool/code.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<heightResize :append="['.page-option-block']">
<code-editor ref="editor" v-model="current.content" :language="this.current.lang"></code-editor>
<code-editor ref="editor" showLineWrappingSet="no" v-model="current.content" :language="this.current.lang"></code-editor>
</heightResize>
<option-block class="page-option-block">
<FormItem>
Expand Down
24 changes: 22 additions & 2 deletions src/views/tool/components/codeEditor.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<template>
<div :style="style">
<input-block right="5px" bottom="5px" :style="style">
<div ref="container" class="code-editor" :style="`height:100%;width:${width}`"></div>
</div>
<template slot="extra">
<Checkbox v-if="showLineWrappingSet !== 'null'" v-model="lineWrapping">{{ $t('main_editor_line_wrapping') }}</Checkbox>
</template>
</input-block>
</template>
<script>
import {format} from "../library/formatter";
Expand All @@ -25,6 +28,10 @@ export default {
type: String,
default: ""
},
showLineWrappingSet: {
type: String,
default: "null"
},
height: {
type: String,
default: "100%"
Expand Down Expand Up @@ -58,6 +65,11 @@ export default {
if (this.editor !== null) {
this.editor.customSetEditorLanguage(newValue);
}
},
lineWrapping(newValue) {
if (this.editor !== null) {
this.editor.setOption("lineWrapping", newValue);
}
}
},
mounted() {
Expand All @@ -66,6 +78,12 @@ export default {
data() {
return {
editor: null,
lineWrapping: true,
}
},
created() {
if (this.showLineWrappingSet !== 'null') {
this.lineWrapping = this.showLineWrappingSet === 'yes'
}
},
methods: {
Expand All @@ -75,6 +93,7 @@ export default {
this.language,
{
lineNumbers: !this.hideLineNumbers,
lineWrapping: this.lineWrapping,
placeholder: this.placeholder
}
);
Expand All @@ -101,6 +120,7 @@ export default {
.CodeMirror {
height: 100%;
}
.CodeMirror pre.CodeMirror-placeholder {
color: #999;
}
Expand Down

0 comments on commit b295d0f

Please sign in to comment.