Skip to content

Commit

Permalink
Updated to disable conversions that do not make any changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tdulcet committed Jan 12, 2025
1 parent 254c9d8 commit 5201632
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@
"message": "Monospace",
"description": "An entry in the context menu. This is an entry for the Unicode font."
},
"menuFontDoubleStruckDoubleStruck": {
"message": "Double-struck",
"description": "An entry in the context menu. This is an entry for the Unicode font."
},
"menuFontDoubleStruck": {
"message": "Double-struck",
"description": "An entry in the context menu. This is an entry for the Unicode font."
Expand Down
4 changes: 3 additions & 1 deletion src/background/modules/ContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,15 @@ async function createMenu(transformationId, menuItems, unicodeFontSettings, exam
menuText = menuText.replaceAll("&", "&&");
if (menuIsShown) {
menus.update(currentTransformationId, {
title: menuText
title: menuText,
enabled: !exampleText || exampleText !== transformedText
});
} else {
await menus.create({
id: currentTransformationId,
parentId: transformationId,
title: menuText,
enabled: !exampleText || exampleText !== transformedText,
contexts: ["editable"]
});
}
Expand Down
10 changes: 5 additions & 5 deletions src/common/modules/UnicodeTransformationHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export function getTransformationType(transformationId) {
function capitalizeEachWord(text) {
return Array.from(segmenterWord.segment(text), ({ segment, isWordLike }) => {
if (isWordLike) {
const [h, ...t] = segment;
return h.toLocaleUpperCase() + t.join("");
const [head, ...tail] = segment;
return head.toLocaleUpperCase() + tail.join("");
}
return segment;
}).join("");
Expand All @@ -87,7 +87,7 @@ function capitalizeEachWord(text) {
* @returns {string}
*/
function sentenceCase(text) {
return Array.from(segmenterSentence.segment(text), ({ segment: [h, ...t] }) => h.toLocaleUpperCase() + t.join("")).join("");
return Array.from(segmenterSentence.segment(text), ({ segment: [head, ...tail] }) => head.toLocaleUpperCase() + tail.join("")).join("");
}

/**
Expand Down Expand Up @@ -226,7 +226,7 @@ function camelCase(atext) {
* @returns {string}
*/
function upperCamelCase(atext) {
return split(atext).map(([h, ...t]) => h.toUpperCase() + t.join("").toLowerCase()).join("");
return split(atext).map(([head, ...tail]) => head.toUpperCase() + tail.join("").toLowerCase()).join("");
}

/**
Expand Down Expand Up @@ -256,7 +256,7 @@ function constantCase(atext) {
* @returns {string}
*/
function adaCase(atext) {
return split(atext).map(([h, ...t]) => h.toUpperCase() + t.join("").toLowerCase()).join("_");
return split(atext).map(([head, ...tail]) => head.toUpperCase() + tail.join("").toLowerCase()).join("_");
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/common/modules/data/Fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const menuStructure = Object.freeze({
[`${FONT_ID_PREFIX}Monospace`]: [
`${FONT_ID_PREFIX}Monospace`
],
[`${FONT_ID_PREFIX}DoubleStruck`]: [
[`${FONT_ID_PREFIX}DoubleStruckDoubleStruck`]: [
`${FONT_ID_PREFIX}DoubleStruck`,
`${FONT_ID_PREFIX}Outlined`
],
Expand Down

0 comments on commit 5201632

Please sign in to comment.