Skip to content

Commit

Permalink
修复部分字体颜色不生效
Browse files Browse the repository at this point in the history
  • Loading branch information
cumany committed Nov 9, 2022
1 parent c895851 commit 2dcf6a5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "editing-toolbar",
"name": "Editing Toolbar",
"version": "2.2.1",
"version": "2.2.2",
"minAppVersion": "0.14.0",
"description": "The Obsidian Editing Toolbar is modified from cmenu, which provides more powerful customization settings and has many built-in editing commands to be a MS Word-like toolbar editing experience.",
"author": "Cuman",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "editing-toolbar",
"name": "Editing Toolbar",
"version": "2.2.1",
"version": "2.2.2",
"minAppVersion": "0.14.0",
"description": "The Obsidian Editing Toolbar is modified from cmenu, which provides more powerful customization settings and has many built-in editing commands to be a MS Word-like toolbar editing experience.",
"author": "Cuman",
Expand Down
7 changes: 6 additions & 1 deletion src/modals/cMenuToolbarModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export function createTablecell(app: App, plugin: cMenuToolbarPlugin, el: string
let backcolor = this.style.backgroundColor;
if (backcolor != "") {
backcolor = setcolorHex(backcolor);
// console.log(backcolor,'backcolor')
if (el == "x-color-picker-table") {
plugin.settings.cMenuFontColor = backcolor;
setFontcolor(app, plugin, backcolor);
Expand Down Expand Up @@ -313,6 +314,7 @@ export function setBackgroundcolor(app: App, plugin: cMenuToolbarPlugin, color:

export const setcolorHex = function (color: string) {
let that = color;

let reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
if (/^(rgb|RGB)/.test(that)) {
let aColor = that.replace(/(?:\(|\)|rgb|RGB)*/g, "").split(",");
Expand All @@ -322,6 +324,10 @@ export const setcolorHex = function (color: string) {
if (hex === "0") {
hex += hex;
}
if(hex.length==1)
{
hex= '0'+hex;
}
strHex += hex;
}
if (strHex.length !== 7) {
Expand All @@ -337,7 +343,6 @@ export const setcolorHex = function (color: string) {
for (let i = 0; i < aNum.length; i += 1) {
numHex += aNum[i] + aNum[i];
}
// console.log(numHex);
return numHex;
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/translations/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
'Please enter a new name:':'Please enter a new name:',
'Drag the slider to move the position':'Drag the slider to move the position',
'Plugin Settings':'Plugin Settings',
'Background-color formatting brush ON!':'Background-color formatting brush ON!',
'Background-color formatting brush ON!':'Background-color formatting brush ON!\nClick the mouse middle or right key to close the formatting-brush',
'Clear formatting brush ON!':'Clear formatting brush ON!',
'Clear formatting brush ON!\nClick the mouse middle or right key to close the formatting-brush':'Clear formatting brush ON!\nClick the mouse middle or right key to close the formatting-brush',

Expand Down
2 changes: 1 addition & 1 deletion src/translations/locale/zh-cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
'Format Brush Off!': '关闭格式刷!',
'Hide & Show': '隐藏 & 显示',
'Editing Toolbar will only refresh automatically after you have either added or deleted a command from it. To see UI changes to cMenuToolbar (above settings changes) use the refresh button. If you forget to refresh in settings, no worries. There is also a refresh button in the cMenuToolbar status bar menu.': '对外观的更改生效需要使用刷新按钮。如果你忘记在设置中刷新,在状态栏菜单中也有一个刷新按钮。',
'Font-Color formatting brush ON!': '字体颜色格式刷开启',
'Font-Color formatting brush ON!': '字体颜色格式刷开启\n点击鼠标中键或者右键关闭格式刷',
'More': '更多',
'Font Colors': '字体颜色',
'Format Brush': '格式刷',
Expand Down

0 comments on commit 2dcf6a5

Please sign in to comment.