Skip to content

Commit

Permalink
Clipboard Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
1John419 committed May 12, 2024
1 parent edd5a2f commit 9859f34
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion js/Model/SettingModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class SettingModel {
themeName: 'Chalcedony',
themeClass: 'theme--chalcedony-light'
});
queue.publish('themes.update', this.themes);
queue.publish('themes.update', this.themes);
}

restore() {
Expand Down
2 changes: 1 addition & 1 deletion js/View/BookmarkListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ class BookmarkListView {
if (target.classList.contains('btn-result')) {
if (this.clipboardMode) {
const text = target.textContent;
navigator.clipboard.writeText(text);
util.writeClipboardText(text);
} else {
const verseIdx = parseInt(target.dataset.verseIdx);
if (this.strongMode) {
Expand Down
2 changes: 1 addition & 1 deletion js/View/HelpReadView.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class HelpReadView {
this.scroll.innerHTML = html;
this.scroll.scrollTop = 0;
}).catch((error) => {
console.log(error);
console.log(error.message);
});
}

Expand Down
2 changes: 1 addition & 1 deletion js/View/ReadView.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class ReadView {
if (btnVerse) {
if (this.clipboardMode) {
const text = `${this.btnBanner.textContent}:${btnVerse.textContent}`;
navigator.clipboard.writeText(text);
util.writeClipboardText(text);
} else {
this.verseClick(btnVerse);
}
Expand Down
2 changes: 1 addition & 1 deletion js/View/SearchResultView.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class SearchResultView {
if (btn) {
if (this.clipboardMode) {
const text = btn.textContent;
navigator.clipboard.writeText(text);
util.writeClipboardText(text);
} else {
const verseIdx = parseInt(btn.dataset.verseIdx);
if (this.strongMode) {
Expand Down
2 changes: 1 addition & 1 deletion js/View/SettingView.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const templateSettingFont = (modifier, name) => {
const divSetting = template.element('div', 'setting', modifier, null, null);
const heading = template.element('h1', 'header', modifier, null, name);
divSetting.appendChild(heading);
const divCarousel = templateSettingCarousel('font', "Font");
const divCarousel = templateSettingCarousel('font', 'Font');
divSetting.appendChild(divCarousel);
return divSetting;
};
Expand Down
8 changes: 8 additions & 0 deletions js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ util.sideScrollElement = (scrollElement, element) => {
const x = element.offsetLeft - 8;
scrollElement.scrollLeft = x;
};

util.writeClipboardText = async (text) => {
try {
await navigator.clipboard.writeText(text);
} catch (error) {
console.log(error.message);
}
};
2 changes: 1 addition & 1 deletion sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const appCaches = [
{
name: 'core-20240509.02',
name: 'core-20240509.03',
urls: [
'/',
'/bundle.js',
Expand Down

0 comments on commit 9859f34

Please sign in to comment.