mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
[WEB] Add AI generator items to the Insert menu (#33967)
* adding abstract generator in the dropdown * add abstract generator to Insert menu dropdown * add Keywords generator to Insert menu * adding title generator and removing some unused code * adding spanish translations * adding buildOpenGeneratorHandler * changing the approach to slots approach * removing the feature flag * niptick * rename the file * adding tests * [WEB] Style changes for Writefull pop-up component (#34067) GitOrigin-RevId: 0bc97c2c1f3dc458a2ca30e8cc54dddfd5bc9b3b
This commit is contained in:
@@ -1050,6 +1050,7 @@ module.exports = {
|
||||
editorLeftMenuSync: [],
|
||||
editorLeftMenuManageTemplate: [],
|
||||
menubarExtraComponents: [],
|
||||
insertMenuSections: [],
|
||||
oauth2Server: [],
|
||||
managedGroupSubscriptionEnrollmentNotification: [],
|
||||
managedGroupEnrollmentInvite: [],
|
||||
|
||||
@@ -127,6 +127,7 @@ const CommandDropdownChild = ({ item }: { item: Entry<TaggedCommand> }) => {
|
||||
onClick={onClickHandler}
|
||||
href={item.href}
|
||||
disabled={item.disabled}
|
||||
leadingIcon={item.leadingIcon}
|
||||
trailingIcon={
|
||||
item.shortcuts && <span>{formatShortcut(item.shortcuts[0])}</span>
|
||||
}
|
||||
|
||||
@@ -33,6 +33,10 @@ const menubarExtraComponents = importOverleafModules(
|
||||
import: { default: ElementType }
|
||||
}[]
|
||||
|
||||
const insertMenuSections = importOverleafModules('insertMenuSections') as {
|
||||
import: { default: MenuSectionStructure[] }
|
||||
}[]
|
||||
|
||||
export const ToolbarMenuBar = () => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
@@ -157,6 +161,9 @@ export const ToolbarMenuBar = () => {
|
||||
id: 'insert-comment',
|
||||
children: ['comment'],
|
||||
},
|
||||
...insertMenuSections.flatMap(
|
||||
({ import: { default: sections } }) => sections
|
||||
),
|
||||
],
|
||||
[t]
|
||||
)
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
useContext,
|
||||
useMemo,
|
||||
useState,
|
||||
ReactNode,
|
||||
} from 'react'
|
||||
|
||||
type CommandInvocationContext = {
|
||||
@@ -19,6 +20,7 @@ export type Command = {
|
||||
handler?: (context: CommandInvocationContext) => void
|
||||
href?: string
|
||||
disabled?: boolean
|
||||
leadingIcon?: ReactNode
|
||||
}
|
||||
|
||||
const CommandRegistryContext = createContext<CommandRegistry | undefined>(
|
||||
|
||||
@@ -216,6 +216,9 @@ const en = {
|
||||
'errors.error-hit-limit-freemium.body':
|
||||
'You’ve hit your daily AI limit. Upgrade now for unlimited language suggestions and LaTeX support, and early access to upcoming features like TikZ generation.',
|
||||
'toolbar.abstract-generator.name': 'Abstract generator',
|
||||
'insert-menu.abstract-generator': 'Abstract',
|
||||
'insert-menu.keywords-generator': 'Keywords',
|
||||
'insert-menu.title-generator': 'Title',
|
||||
'toolbar.abstract-generator.disabled_non_english':
|
||||
'You need to be writing in English to generate an abstract',
|
||||
'toolbar.keywords-generator.name': 'Keywords generator',
|
||||
@@ -750,6 +753,9 @@ const es = {
|
||||
'errors.error-hit-limit-freemium.body':
|
||||
'Has agotado tu cuota de Writefull. Actualiza ahora para obtener sugerencias de lenguaje ilimitadas y soporte en LaTeX, y acceso anticipado a las próximas funciones de generación como TikZ.',
|
||||
'toolbar.abstract-generator.name': 'Generar Abstract',
|
||||
'insert-menu.abstract-generator': 'Abstract',
|
||||
'insert-menu.keywords-generator': 'Palabras clave',
|
||||
'insert-menu.title-generator': 'Título',
|
||||
'toolbar.abstract-generator.disabled_non_english':
|
||||
'Necesitas estar en un documento en inglés para generar un abstract',
|
||||
'toolbar.keywords-generator.name': 'Generar Palabras Clave',
|
||||
|
||||
Reference in New Issue
Block a user