Patch up several things
This commit is contained in:
parent
621e4ce6fd
commit
cc928d6e5a
|
@ -1366,8 +1366,20 @@
|
|||
"description": "Header for the table of contents block listing style section names in the left panel of the classic editor"
|
||||
},
|
||||
"linking": {
|
||||
"message": "Linking",
|
||||
"description": "Header for the section to link the style with other services."
|
||||
"message": "UserStyles.world integration",
|
||||
"description": "Header for the section to link the style with userStyles.world"
|
||||
},
|
||||
"linkStyle": {
|
||||
"message": "Link Style",
|
||||
"description": "Link the current style with userstyles.world"
|
||||
},
|
||||
"uploadStyle": {
|
||||
"message": "Upload Style",
|
||||
"description": "Upload the current style to userstyles.world"
|
||||
},
|
||||
"revokeLink": {
|
||||
"message": "Revoke Link",
|
||||
"description": "Revoke current link of style with userstyles.world"
|
||||
},
|
||||
"shortcuts": {
|
||||
"message": "Shortcuts",
|
||||
|
|
|
@ -56,10 +56,8 @@ const styleMan = (() => {
|
|||
let ready = init();
|
||||
|
||||
chrome.runtime.onConnect.addListener(handleLivePreview);
|
||||
|
||||
chrome.runtime.onConnect.addListener(handleLinkingUSW);
|
||||
|
||||
|
||||
//#endregion
|
||||
//#region Exports
|
||||
|
||||
|
@ -381,7 +379,8 @@ const styleMan = (() => {
|
|||
if (!style._usw.token) {
|
||||
return;
|
||||
}
|
||||
uploadStyle(style._usw.token, style);
|
||||
uploadStyle(style);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ async function retrieveStyleInformation(token) {
|
|||
}
|
||||
|
||||
/* exported uploadStyle */
|
||||
async function uploadStyle(token, style) {
|
||||
async function uploadStyle(style) {
|
||||
return (await (await fetch(`${URLS.usw}api/style/${style._usw.id}`, {
|
||||
method: 'POST',
|
||||
headers: new Headers({
|
||||
'Authorization': `Bearer ${token}`,
|
||||
'Authorization': `Bearer ${style._usw.token}`,
|
||||
'Content-Type': 'application/json',
|
||||
}),
|
||||
body: JSON.stringify({
|
||||
|
|
|
@ -395,12 +395,12 @@
|
|||
<details id="linking" data-pref="editor.toc.expanded" class="ignore-pref-if-compact">
|
||||
<summary><h2 i18n-text="linking"></h2></summary>
|
||||
<div id="pre-linking">
|
||||
<button id="link-style">Link style</button>
|
||||
<button id="link-style" i18n-text="linkStyle"></button>
|
||||
</div>
|
||||
<div id="after-linking">
|
||||
<div>
|
||||
<button id="upload-style">Upload style</button>
|
||||
<button id="revoke-style">Revoke linking</button>
|
||||
<button id="upload-style" i18n-text="uploadStyle"></button>
|
||||
<button id="revoke-link" i18n-text="revokeLink"></button>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
|
|
@ -45,7 +45,7 @@ baseInit.ready.then(async () => {
|
|||
$('#lint-help').onclick = () =>
|
||||
require(['/edit/linter-dialogs'], () => linterMan.showLintHelp());
|
||||
$('#link-style').onclick = () => linkToUSW();
|
||||
$('#revoke-style').onclick = () => revokeLinking();
|
||||
$('#revoke-link').onclick = () => revokeLinking();
|
||||
$('#upload-style').onclick = () => uploadStyle();
|
||||
require([
|
||||
'/edit/autocomplete',
|
||||
|
|
Loading…
Reference in New Issue
Block a user