-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into 739-localization-cont…
…ributions
- Loading branch information
Showing
87 changed files
with
1,555 additions
and
1,393 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
extensions/src/resource-viewer/README.md → ...s/src/platform-scripture-editor/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
16 changes: 16 additions & 0 deletions
16
extensions/src/platform-scripture-editor/contributions/localizedStrings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"metadata": {}, | ||
"localizedStrings": { | ||
"en": { | ||
"%mainMenu_openPlatformScriptureEditor%": "Open Scripture Editor", | ||
"%mainMenu_openPlatformResourceViewer%": "Open Resource Viewer", | ||
"%webView_platformScriptureEditor_options%": "Options", | ||
"%webView_platformScriptureEditor_info%": "Info", | ||
"%webView_platformScriptureEditor_backgroundColor%": "Background Color", | ||
"%webView_platformScriptureEditor_textColor%": "Text Color", | ||
"%webView_platformScriptureEditor_thickBorders%": "Thick Borders", | ||
"%webView_platformScriptureEditor_publisherInfo%": "Publisher Info", | ||
"%webView_platformScriptureEditor_copyrightInfo%": "Copyright Info" | ||
} | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
extensions/src/platform-scripture-editor/contributions/menus.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"mainMenu": { | ||
"columns": {}, | ||
"groups": {}, | ||
"items": [ | ||
{ | ||
"label": "%mainMenu_openPlatformScriptureEditor%", | ||
"localizeNotes": "Application main menu > Project > Open Scripture Editor", | ||
"group": "platform.projectResources", | ||
"order": -100, | ||
"command": "platformScriptureEditor.openScriptureEditor" | ||
}, | ||
{ | ||
"label": "%mainMenu_openPlatformResourceViewer%", | ||
"localizeNotes": "Application main menu > Project > Open Resource Viewer", | ||
"group": "platform.projectResources", | ||
"order": -99, | ||
"command": "platformScriptureEditor.openResourceViewer" | ||
} | ||
] | ||
}, | ||
"webViewMenus": { | ||
"platformScriptureEditor.react": { | ||
"includeDefaults": true, | ||
"topMenu": { | ||
"columns": { | ||
"platformScriptureEditor.options": { | ||
"label": "%webView_platformScriptureEditor_options%", | ||
"order": 3 | ||
}, | ||
"platformScriptureEditor.info": { | ||
"label": "%webView_platformScriptureEditor_info%", | ||
"order": 4 | ||
} | ||
}, | ||
"groups": { | ||
"platformScriptureEditor.colors": { | ||
"column": "platformScriptureEditor.options", | ||
"order": 1 | ||
}, | ||
"platformScriptureEditor.layout": { | ||
"column": "platformScriptureEditor.options", | ||
"order": 2 | ||
}, | ||
"platformScriptureEditor.general": { | ||
"column": "platformScriptureEditor.info", | ||
"order": 2 | ||
} | ||
}, | ||
"items": [ | ||
{ | ||
"label": "%webView_platformScriptureEditor_backgroundColor%", | ||
"group": "platformScriptureEditor.colors", | ||
"order": 2, | ||
"command": "platformScriptureEditor.changeBackgroundColor" | ||
}, | ||
{ | ||
"label": "%webView_platformScriptureEditor_textColor%", | ||
"group": "platformScriptureEditor.colors", | ||
"order": 1, | ||
"command": "platformScriptureEditor.changeTextColor" | ||
}, | ||
{ | ||
"label": "%webView_platformScriptureEditor_thickBorders%", | ||
"group": "platformScriptureEditor.layout", | ||
"order": 1, | ||
"command": "platformScriptureEditor.showThickBorders" | ||
}, | ||
{ | ||
"label": "%webView_platformScriptureEditor_publisherInfo%", | ||
"group": "platformScriptureEditor.general", | ||
"order": 1, | ||
"command": "platformScriptureEditor.showPublisherInfo" | ||
}, | ||
{ | ||
"label": "%webView_platformScriptureEditor_copyrightInfo%", | ||
"group": "platformScriptureEditor.general", | ||
"order": 2, | ||
"command": "platformScriptureEditor.showCopyrightInfo" | ||
} | ||
] | ||
}, | ||
"contextMenu": { | ||
"groups": {}, | ||
"items": [] | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
extensions/src/resource-viewer/manifest.json → ...c/platform-scripture-editor/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
extensions/src/resource-viewer/package.json → ...rc/platform-scripture-editor/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
extensions/src/platform-scripture-editor/src/_editor-overrides.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/* Platform.Bible image protocol overrides */ | ||
/* stylelint-disable selector-no-qualifying-type */ | ||
|
||
.editor-container { | ||
max-width: none; | ||
} | ||
|
||
.link-editor div.link-edit { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/pencil-fill.svg'); | ||
} | ||
|
||
i.undo { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/arrow-counterclockwise.svg'); | ||
} | ||
|
||
i.redo { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/arrow-clockwise.svg'); | ||
} | ||
|
||
%paragraph { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/text-paragraph.svg'); | ||
} | ||
|
||
%h-one { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/type-h1.svg'); | ||
} | ||
|
||
%h-two { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/type-h2.svg'); | ||
} | ||
|
||
%h-three { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/type-h3.svg'); | ||
} | ||
|
||
%square-one { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/1-square.svg'); | ||
} | ||
|
||
%square-two { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/2-square.svg'); | ||
} | ||
|
||
%square-three { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/3-square.svg'); | ||
} | ||
|
||
%square-four { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/4-square.svg'); | ||
} | ||
|
||
%bookmark { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/bookmark.svg'); | ||
} | ||
|
||
%file-earmark { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/file-earmark.svg'); | ||
} | ||
|
||
.icon.bullet-list, | ||
.icon.ul { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/list-ul.svg'); | ||
} | ||
|
||
.icon.numbered-list, | ||
.icon.ol { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/list-ol.svg'); | ||
} | ||
|
||
%quote { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/chat-square-quote.svg'); | ||
} | ||
|
||
.icon.ban { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/ban.svg'); | ||
} | ||
|
||
.icon.code { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/code.svg'); | ||
} | ||
|
||
i.bold { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/type-bold.svg'); | ||
} | ||
|
||
i.italic { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/type-italic.svg'); | ||
} | ||
|
||
i.underline { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/type-underline.svg'); | ||
} | ||
|
||
i.strikethrough { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/type-strikethrough.svg'); | ||
} | ||
|
||
i.code { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/code.svg'); | ||
} | ||
|
||
i.link { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/link.svg'); | ||
} | ||
|
||
i.left-align { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/text-left.svg'); | ||
} | ||
|
||
i.center-align { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/text-center.svg'); | ||
} | ||
|
||
i.right-align { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/text-right.svg'); | ||
} | ||
|
||
i.justify-align { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/justify.svg'); | ||
} | ||
|
||
i.chevron-down { | ||
background-image: url('papi-extension://platformScriptureEditor/assets/images/icons/chevron-down.svg'); | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import papi, { logger } from '@papi/backend'; | ||
import type { | ||
ExecutionActivationContext, | ||
GetWebViewOptions, | ||
IWebViewProvider, | ||
SavedWebViewDefinition, | ||
WebViewDefinition, | ||
} from '@papi/core'; | ||
import platformScriptureEditorWebView from './platform-scripture-editor.web-view?inline'; | ||
import platformScriptureEditorWebViewStyles from './platform-scripture-editor.web-view.scss?inline'; | ||
|
||
logger.info('Scripture Editor is importing!'); | ||
|
||
const scriptureEditorWebViewType = 'platformScriptureEditor.react'; | ||
|
||
interface PlatformScriptureEditorOptions extends GetWebViewOptions { | ||
projectId: string | undefined; | ||
isReadOnly: boolean; | ||
} | ||
|
||
/** Temporary function to manually control `isReadOnly`. Registered as a command handler. */ | ||
async function openPlatformScriptureEditor( | ||
projectId: string | undefined, | ||
): Promise<string | undefined> { | ||
// The second argument (isReadOnly) is hardcoded for now, but should be a parameter in the future | ||
return open(projectId, false); | ||
} | ||
|
||
/** Temporary function to manually control `isReadOnly`. Registered as a command handler. */ | ||
async function openPlatformResourceViewer( | ||
projectId: string | undefined, | ||
): Promise<string | undefined> { | ||
// The second argument (isReadOnly) is hardcoded for now, but should be a parameter in the future | ||
return open(projectId, true); | ||
} | ||
|
||
/** Function to prompt for a project and open it in the editor */ | ||
async function open( | ||
projectId: string | undefined, | ||
isReadOnly: boolean, | ||
): Promise<string | undefined> { | ||
let projectIdForWebView = projectId; | ||
if (!projectIdForWebView) { | ||
projectIdForWebView = await papi.dialogs.selectProject({ | ||
title: 'Select Resource', | ||
prompt: 'Choose the resource project:', | ||
includeProjectTypes: '^ParatextStandard$', | ||
}); | ||
} | ||
if (projectIdForWebView) { | ||
const options: PlatformScriptureEditorOptions = { projectId: projectIdForWebView, isReadOnly }; | ||
// REVIEW: If an editor is already open for the selected project, we open another. | ||
// This matches the current behavior in P9, though it might not be what we want long-term. | ||
return papi.webViews.getWebView(scriptureEditorWebViewType, undefined, options); | ||
} | ||
return undefined; | ||
} | ||
|
||
/** Simple web view provider that provides Resource web views when papi requests them */ | ||
const scriptureEditorWebViewProvider: IWebViewProvider = { | ||
async getWebView( | ||
savedWebView: SavedWebViewDefinition, | ||
getWebViewOptions: PlatformScriptureEditorOptions, | ||
): Promise<WebViewDefinition | undefined> { | ||
if (savedWebView.webViewType !== scriptureEditorWebViewType) | ||
throw new Error( | ||
`${scriptureEditorWebViewType} provider received request to provide a ${savedWebView.webViewType} web view`, | ||
); | ||
|
||
// We know that the projectId (if present in the state) will be a string. | ||
const projectId = | ||
getWebViewOptions.projectId || | ||
// eslint-disable-next-line no-type-assertion/no-type-assertion | ||
(savedWebView.state?.projectId as string) || | ||
undefined; | ||
const isReadOnly = getWebViewOptions.isReadOnly || savedWebView.state?.isReadOnly; | ||
let title = ''; | ||
if (projectId) { | ||
title = `${(await papi.projectLookup.getMetadataForProject(projectId)).name ?? projectId}${isReadOnly ? '' : ' (Editable)'}`; | ||
} else title = isReadOnly ? 'Resource Viewer' : 'Scripture Editor'; | ||
|
||
return { | ||
title, | ||
...savedWebView, | ||
content: platformScriptureEditorWebView, | ||
styles: platformScriptureEditorWebViewStyles, | ||
state: { | ||
...savedWebView.state, | ||
projectId, | ||
isReadOnly, | ||
}, | ||
}; | ||
}, | ||
}; | ||
|
||
export async function activate(context: ExecutionActivationContext): Promise<void> { | ||
logger.info('Scripture editor is activating!'); | ||
|
||
const openPlatformScriptureEditorPromise = papi.commands.registerCommand( | ||
'platformScriptureEditor.openScriptureEditor', | ||
openPlatformScriptureEditor, | ||
); | ||
|
||
const openPlatformResourceViewerPromise = papi.commands.registerCommand( | ||
'platformScriptureEditor.openResourceViewer', | ||
openPlatformResourceViewer, | ||
); | ||
|
||
const scriptureEditorWebViewProviderPromise = papi.webViewProviders.register( | ||
scriptureEditorWebViewType, | ||
scriptureEditorWebViewProvider, | ||
); | ||
|
||
// Await the registration promises at the end so we don't hold everything else up | ||
context.registrations.add( | ||
await scriptureEditorWebViewProviderPromise, | ||
await openPlatformScriptureEditorPromise, | ||
await openPlatformResourceViewerPromise, | ||
); | ||
|
||
logger.info('Scripture editor is finished activating!'); | ||
} |
File renamed without changes.
Oops, something went wrong.