feat: Completed the emoji lists for workspace picker and other small changes, b=closes #7608, c=common, workspaces

This commit is contained in:
Mr. M
2025-06-12 10:44:04 +02:00
parent ce75bc152a
commit 219d1989d9
9 changed files with 104 additions and 26 deletions

2
l10n

Submodule l10n updated: 75a7af69ae...2f8eb28cb6

View File

@@ -1,5 +1,5 @@
diff --git a/browser/components/urlbar/UrlbarInput.sys.mjs b/browser/components/urlbar/UrlbarInput.sys.mjs
index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..1cf86995514b2c00360f6ed681f0c640dac8ab56 100644
index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..370bd107be760893516360bd85553acb6533774b 100644
--- a/browser/components/urlbar/UrlbarInput.sys.mjs
+++ b/browser/components/urlbar/UrlbarInput.sys.mjs
@@ -68,6 +68,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
@@ -187,7 +187,15 @@ index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..1cf86995514b2c00360f6ed681f0c640
let controller =
this.document.commandDispatcher.getControllerForCommand("cmd_paste");
@@ -4136,6 +4204,11 @@ export class UrlbarInput {
@@ -4025,6 +4093,7 @@ export class UrlbarInput {
_setPlaceholder(name) {
this.document.l10n.setAttributes(
this.inputField,
+ this.window.gZenVerticalTabsManager._hasSetSingleToolbar ? 'zen-singletoolbar-urlbar-placeholder-with-name' :
name ? "urlbar-placeholder-with-name" : "urlbar-placeholder",
name ? { name } : undefined
);
@@ -4136,6 +4205,11 @@ export class UrlbarInput {
}
_on_click(event) {
@@ -199,7 +207,7 @@ index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..1cf86995514b2c00360f6ed681f0c640
if (
event.target == this.inputField ||
event.target == this._inputContainer ||
@@ -4207,7 +4280,7 @@ export class UrlbarInput {
@@ -4207,7 +4281,7 @@ export class UrlbarInput {
}
}
@@ -208,7 +216,7 @@ index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..1cf86995514b2c00360f6ed681f0c640
this.view.autoOpen({ event });
} else {
if (this._untrimOnFocusAfterKeydown) {
@@ -4247,9 +4320,16 @@ export class UrlbarInput {
@@ -4247,9 +4321,16 @@ export class UrlbarInput {
}
_on_mousedown(event) {
@@ -226,7 +234,7 @@ index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..1cf86995514b2c00360f6ed681f0c640
if (
event.target != this.inputField &&
@@ -4261,6 +4341,10 @@ export class UrlbarInput {
@@ -4261,6 +4342,10 @@ export class UrlbarInput {
this.focusedViaMousedown = !this.focused;
this._preventClickSelectsAll = this.focused;
@@ -237,7 +245,7 @@ index 0c5145c3d31862bd2c6b5ed2faa88f02425ffde1..1cf86995514b2c00360f6ed681f0c640
// Keep the focus status, since the attribute may be changed
// upon calling this.focus().
@@ -4301,7 +4385,7 @@ export class UrlbarInput {
@@ -4301,7 +4386,7 @@ export class UrlbarInput {
}
// Don't close the view when clicking on a tab; we may want to keep the
// view open on tab switch, and the TabSelect event arrived earlier.

View File

@@ -981,6 +981,7 @@ var gZenVerticalTabsManager = {
gURLBar._initCopyCutController();
gURLBar._initPasteAndGo();
gURLBar._initStripOnShare();
gURLBar._updatePlaceholderFromDefaultEngine();
},
rebuildAreas() {

View File

@@ -83,6 +83,7 @@
#onPopupShowing(event) {
if (event.target !== this.#panel) return;
this.searchInput.value = '';
const emojiList = this.emojiList;
for (const emoji of this.#emojis) {
const item = document.createXULElement('toolbarbutton');
@@ -94,6 +95,7 @@
});
emojiList.appendChild(item);
}
this.searchInput.focus();
}
#onPopupHidden(event) {

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,56 @@
import os
import requests
import json
def get_emojis(url):
"""
Fetches emojis from the given URL and formats them into a JavaScript module.
Args:
url (str): The URL to fetch the emoji data from.
Returns:
array: A JavaScript array of emoji objects formatted for use in a module.
"""
response = requests.get(url)
response.raise_for_status() # Raise an error for bad responses
emojis_data = response.json()
# We only want "tags", "emoji" amd "order" from the dictionaries inside this array
emojis = []
for emoji in emojis_data:
emojis.append({
"tags": emoji.get("tags", []),
"order": emoji.get("order", 0),
"emoji": emoji.get("emoji", "")
})
return emojis
def get_js_code(emojis):
"""
Generates JavaScript code to export the emojis as a module.
Args:
emojis (list): A list of emoji dictionaries.
Returns:
str: JavaScript code as a string.
"""
js_code = "var ZenEmojisData = "
# dump without unicode escape
js_code += json.dumps(emojis, ensure_ascii=False)
return js_code
if __name__ == "__main__":
# Define the URL for the emoji JSON file
url = "https://cdn.jsdelivr.net/npm/emoji-picker-element-data@^1/en/emojibase/data.json"
emojis_path = os.path.join(os.path.dirname(__file__), "ZenEmojisData.min.mjs")
emojis = get_emojis(url)
js_code = get_js_code(emojis)
with open(emojis_path, "w", encoding="utf-8") as file:
file.write(js_code)
print(f"Emojis data has been written to {emojis_path}")

View File

@@ -170,23 +170,26 @@
document.getElementById('nav-bar').style.visibility = 'collapse';
}
this.style.visibility = 'visible';
gZenUIManager.motion.animate(
this.elementsToAnimate,
{
y: [20, 0],
opacity: [0, 1],
filter: ['blur(2px)', 'blur(0)'],
},
{
duration: 0.6,
type: 'spring',
bounce: 0,
delay: gZenUIManager.motion.stagger(0.05, { startDelay: 0.2 }),
}
);
gZenUIManager.motion
.animate(
this.elementsToAnimate,
{
y: [20, 0],
opacity: [0, 1],
filter: ['blur(2px)', 'blur(0)'],
},
{
duration: 0.6,
type: 'spring',
bounce: 0,
delay: gZenUIManager.motion.stagger(0.05, { startDelay: 0.2 }),
}
)
.then(() => {
gZenWorkspaces.workspaceElement(this.workspaceId).hidden = false;
this.resolveInitialized();
});
});
this.resolveInitialized();
}
async onCreateButtonCommand() {

View File

@@ -468,6 +468,10 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
workspaceWrapper.active = true;
}
if (document.documentElement.hasAttribute('zen-creating-workspace')) {
workspaceWrapper.hidden = true; // Hide workspace while creating it
}
await new Promise((resolve) => {
workspaceWrapper.addEventListener(
'ZenWorkspaceAttached',
@@ -1521,6 +1525,10 @@ var gZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
async _organizeWorkspaceStripLocations(workspace, justMove = false, offsetPixels = 0) {
if (document.documentElement.hasAttribute('zen-creating-workspace')) {
// If we are creating a workspace, we don't want to animate the strip
return;
}
this._organizingWorkspaceStrip = true;
const workspaces = await this._workspaces();
let workspaceIndex = workspaces.workspaces.findIndex((w) => w.uuid === workspace.uuid);

View File

@@ -19,7 +19,7 @@
"brandShortName": "Zen",
"brandFullName": "Zen Browser",
"release": {
"displayVersion": "1.12.11b",
"displayVersion": "1.13b",
"github": {
"repo": "zen-browser/desktop"
},
@@ -39,7 +39,7 @@
"brandShortName": "Twilight",
"brandFullName": "Zen Twilight",
"release": {
"displayVersion": "1.13t",
"displayVersion": "1.14t",
"github": {
"repo": "zen-browser/desktop"
}