Skip to content

Commit b295d0f

Browse files
committed
1.9.3 update
1 parent 15c012d commit b295d0f

File tree

8 files changed

+1266
-282
lines changed

8 files changed

+1266
-282
lines changed

README.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@
1212

1313
## chrome 安装
1414

15-
- 方法1: 在 [Chrome 应用商店](https://chrome.google.com/webstore/detail/ipfcebkfhpkjeikaammlkcnalknjahmh) 安装
16-
- 方法2: [下载 .crx 安装包](https://github.com/baiy/Ctool/releases/latest)
17-
- 方法3: [百度网盘下载](https://pan.baidu.com/s/1mhWbqWC) 安装方法和方法2一致
18-
19-
> 方法2 / 方法3 不定期维护 仅供网络环境特别恶劣的同学使用
20-
>
21-
> [猛戳这里查看手动安装`.crx`教程](http://www.cnplugins.com/tool/outline-install-crx-file.html)
15+
-[Chrome 应用商店](https://chrome.google.com/webstore/detail/ipfcebkfhpkjeikaammlkcnalknjahmh) 安装
2216

2317
## 微软 Edge 安装
2418

@@ -30,9 +24,7 @@
3024

3125
## utools 安装
3226

33-
### 插件中心安装
34-
35-
> 插件中心搜索 `ctool`
27+
- [utools](https://u.tools/) 插件中心 搜索 `ctool`
3628

3729
## 开发
3830

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

8477
## 第三方开源库
8578

package-lock.json

Lines changed: 1186 additions & 224 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "c-tool",
3-
"version": "1.9.2",
3+
"version": "1.9.3",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve --port 8081",
@@ -17,14 +17,15 @@
1717
"babel-runtime": "^6.26.0",
1818
"bignumber.js": "^9.0.1",
1919
"code-formatter": "0.0.1",
20-
"codemirror": "^5.63.3",
21-
"codemirror-graphql": "^1.1.0",
20+
"codemirror": "^5.64.0",
21+
"codemirror-graphql": "^1.2.4",
22+
"cosmiconfig": "^7.0.1",
2223
"cron-parser": "^2.16.3",
2324
"cronstrue": "^1.122.0",
2425
"crypto-js": "^3.3.0",
2526
"diff-match-patch": "^1.0.5",
2627
"file": "^0.2.2",
27-
"graphql": "15.5.0",
28+
"graphql": "15.7.2",
2829
"ipinyinjs": "^1.0.0",
2930
"jian_fan": "^1.0.3",
3031
"jimp": "^0.16.1",
@@ -35,21 +36,21 @@
3536
"json-to-properties": "^1.1.3",
3637
"json5": "^2.2.0",
3738
"jsonlint": "^1.6.3",
38-
"jsrsasign": "^10.4.1",
39+
"jsrsasign": "^10.5.0",
3940
"jsrsasign-util": "^1.0.5",
4041
"jwt-decode": "^3.1.2",
4142
"lodash": "^4.17.21",
4243
"mime-types": "^2.1.34",
4344
"moment": "^2.29.1",
4445
"php-array-reader": "^1.3.2",
4546
"phparr": "^0.2.0",
46-
"postcss": "^8.3.11",
47+
"postcss": "^8.4.4",
4748
"postcss-less": "^5.0.0",
4849
"postcss-scss": "^4.0.2",
49-
"prettier": "^2.4.1",
50+
"prettier": "^2.5.0",
5051
"prettier-plugin-sql": "^0.3.0",
5152
"properties-to-json": "^0.1.7",
52-
"qrcode": "^1.4.4",
53+
"qrcode": "^1.5.0",
5354
"qrcode-parser": "^1.2.0",
5455
"query-string": "^6.14.1",
5556
"serialize-php": "^1.1.2",

src/i18n/locales/en/main.i18n.json5

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,6 @@
7171
"tool_binary": "trueForm/inverse/complement",
7272
"tool_armConverter": "ARM/HEX",
7373
// other
74-
"css_main_category_item_style": "padding: 0 10px"
74+
"css_main_category_item_style": "padding: 0 10px",
75+
"editor_line_wrapping": "Line Wrapping"
7576
}

src/i18n/locales/zh_CN/main.i18n.json5

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,22 @@
5555
"tool_regex": "正则表达式",
5656
"tool_randomString": "随机字符生成",
5757
"tool_serializeConversion": "序列化转换",
58-
"tool_diffs": "文本差异化对比",
59-
"tool_crontab": "crontab校验",
60-
"tool_websocket": "websocket调试",
58+
"tool_diffs": "文本比对",
59+
"tool_crontab": "crontab",
60+
"tool_websocket": "websocket",
6161
"tool_unit": "单位换算",
6262
"tool_time": "时间计算器",
6363
"tool_uuid": "UUID生成",
6464
"tool_jsonToObject": "JSON转实体类",
65-
"tool_ascii": "ASCII转换",
66-
"tool_variableConversion": "变量名转换",
65+
"tool_ascii": "ASCII",
66+
"tool_variableConversion": "变量名",
6767
"tool_jwt": "JWT解码",
6868
"tool_hexString": "Hex/String",
6969
"tool_text": "文本处理",
7070
"tool_html": "Html编码",
7171
"tool_binary": "原码/反码/补码",
7272
"tool_armConverter": "ARM/HEX",
7373
// 其他
74-
"css_main_category_item_style": "padding: 0 20px"
74+
"css_main_category_item_style": "padding: 0 20px",
75+
"editor_line_wrapping": "自动换行"
7576
}

src/tool/model.js

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,25 @@ const debounceSaveToolDataMethod = _.debounce(function () {
5252
}, 1000)
5353

5454

55-
const appendData = async function (field = "", check = "") {
55+
const appendData = async function (check = "") {
5656
const result = (data = "") => {
57-
if (data){
57+
if (data) {
5858
if (
5959
!check
6060
|| (_.isFunction(check) && check(data)) // 函数校验
61-
){
62-
return field ? {[field]: data} : data
61+
) {
62+
return data
6363
}
6464
}
65-
return field ? {} : ""
65+
return ""
6666
}
6767
return new Promise(async (resolve) => {
6868
try {
6969
// 使用固定输入数据
7070
if (fixeInputData) {
71-
return resolve(result(fixeInputData))
71+
let temp = fixeInputData
72+
fixeInputData = ""
73+
return resolve(result(temp))
7274
}
7375
if (setting.autoReadCopy()) {
7476
let paste = (await clipboard.paste()).trim()
@@ -87,34 +89,38 @@ export const plugin = {
8789
install: function (Vue) {
8890
Vue.prototype.$initToolData = function (input = "", inputCheck = "", field = "current", isLoadHistory = true) {
8991
let current = _.cloneDeep(this[field])
92+
let inputHistory = ""
93+
let inputDefault = ""
94+
let inputAppend = ""
95+
// 默认数据
96+
if (input && (input in current) && current[input]) {
97+
inputDefault = current[input];
98+
}
99+
// 历史数据
90100
if (isLoadHistory) {
101+
let history = this.$getToolData()
102+
if (input && (input in history)) {
103+
inputHistory = history[input]
104+
delete history[input]
105+
}
91106
Object.assign(current, this.$getToolData())
92107
}
108+
93109
if (!input) {
94110
this[field] = current
95111
return;
96112
}
97113

98-
// 初始化默认值
99-
if (!(input in current)){
100-
current[input] = "";
101-
}
102-
103-
// 保存默认值
104-
let inputDefault = current[input]
105-
current[input] = "";
106-
107-
appendData(input, inputCheck).then((append) => {
108-
for (let key of Object.keys(append)) {
109-
if ((key in current) && !current[key]) {
110-
current[key] = append[key]
114+
// 追加剪贴板等数据
115+
appendData(inputCheck).then((append) => {
116+
inputAppend = append
117+
this[field] = Object.assign(
118+
current,
119+
{
120+
// 历史数据 > 追加数据 > 默认数据
121+
[input]: inputHistory ? inputHistory : (inputAppend ? inputAppend : inputDefault)
111122
}
112-
}
113-
if (!current[input]){
114-
// 使用默认值
115-
current[input] = inputDefault
116-
}
117-
this[field] = current
123+
)
118124
})
119125
}
120126
Vue.prototype.$getToolData = function () {

src/views/tool/code.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div>
33
<heightResize :append="['.page-option-block']">
4-
<code-editor ref="editor" v-model="current.content" :language="this.current.lang"></code-editor>
4+
<code-editor ref="editor" showLineWrappingSet="no" v-model="current.content" :language="this.current.lang"></code-editor>
55
</heightResize>
66
<option-block class="page-option-block">
77
<FormItem>

src/views/tool/components/codeEditor.vue

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<template>
2-
<div :style="style">
2+
<input-block right="5px" bottom="5px" :style="style">
33
<div ref="container" class="code-editor" :style="`height:100%;width:${width}`"></div>
4-
</div>
4+
<template slot="extra">
5+
<Checkbox v-if="showLineWrappingSet !== 'null'" v-model="lineWrapping">{{ $t('main_editor_line_wrapping') }}</Checkbox>
6+
</template>
7+
</input-block>
58
</template>
69
<script>
710
import {format} from "../library/formatter";
@@ -25,6 +28,10 @@ export default {
2528
type: String,
2629
default: ""
2730
},
31+
showLineWrappingSet: {
32+
type: String,
33+
default: "null"
34+
},
2835
height: {
2936
type: String,
3037
default: "100%"
@@ -58,6 +65,11 @@ export default {
5865
if (this.editor !== null) {
5966
this.editor.customSetEditorLanguage(newValue);
6067
}
68+
},
69+
lineWrapping(newValue) {
70+
if (this.editor !== null) {
71+
this.editor.setOption("lineWrapping", newValue);
72+
}
6173
}
6274
},
6375
mounted() {
@@ -66,6 +78,12 @@ export default {
6678
data() {
6779
return {
6880
editor: null,
81+
lineWrapping: true,
82+
}
83+
},
84+
created() {
85+
if (this.showLineWrappingSet !== 'null') {
86+
this.lineWrapping = this.showLineWrappingSet === 'yes'
6987
}
7088
},
7189
methods: {
@@ -75,6 +93,7 @@ export default {
7593
this.language,
7694
{
7795
lineNumbers: !this.hideLineNumbers,
96+
lineWrapping: this.lineWrapping,
7897
placeholder: this.placeholder
7998
}
8099
);
@@ -101,6 +120,7 @@ export default {
101120
.CodeMirror {
102121
height: 100%;
103122
}
123+
104124
.CodeMirror pre.CodeMirror-placeholder {
105125
color: #999;
106126
}

0 commit comments

Comments
 (0)