Files
supabase/apps/studio/components/interfaces/ProjectAPIDocs/Content/Content.utils.ts
Ivan Vasilov 436bdb10ae chore: Move the studio app to apps/studio (#18915)
* Move all studio files from /studio to /apps/studio.

* Move studio specific prettier ignores.

* Fix the ui references from studio.

* Fix the css imports.

* Fix all package.json issues.

* Fix the prettier setup for the studio app.

* Add .turbo folder to prettierignore.

* Fix the github workflows.
2023-11-15 12:38:55 +01:00

21 lines
788 B
TypeScript

export const navigateToSection = (key: string) => {
if (typeof window !== 'undefined') {
const el = document.getElementById(key)
if (el) el.scrollIntoView({ behavior: 'smooth' })
}
}
// Removes some auto-generated Postgrest text
// Ideally PostgREST wouldn't add this if there is already a comment
export const tempRemovePostgrestText = (content: string) => {
const postgrestTextPk = `Note:\nThis is a Primary Key.<pk/>`
const postgrestTextFk = `Note:\nThis is a Foreign Key to`
const pkTextPos = content.lastIndexOf(postgrestTextPk)
const fkTextPos = content.lastIndexOf(postgrestTextFk)
let cleansed = content
if (pkTextPos >= 0) cleansed = cleansed.substring(0, pkTextPos)
if (fkTextPos >= 0) cleansed = cleansed.substring(0, fkTextPos)
return cleansed
}