Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lexical][Meta] Add meta intern static docs config #16

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,172 changes: 1,147 additions & 25 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/lexical-selection/src/lexical-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ function $patchStyle(
* Will update partially selected TextNodes by splitting the TextNode and applying
* the styles to the appropriate one.
* @param selection - The selected node(s) to update.
* @param patch - The patch to apply, which can include multiple styles. { CSSProperty: value }. Can also accept a function that returns the new property value.
* @param patch - The patch to apply, which can include multiple styles. \\{CSSProperty: value\\} . Can also accept a function that returns the new property value.
*/
export function $patchStyleText(
selection: BaseSelection,
Expand Down
6 changes: 3 additions & 3 deletions packages/lexical-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ export function isMimeType(
* 3. Order aware (respects the order when multiple Files are passed)
*
* const filesResult = await mediaFileReader(files, ['image/']);
* filesResult.forEach(file => editor.dispatchCommand('INSERT_IMAGE', {
* filesResult.forEach(file => editor.dispatchCommand('INSERT_IMAGE', \\{
* src: file.result,
* }));
* \\}));
*/
export function mediaFileReader(
files: Array<File>,
Expand Down Expand Up @@ -174,7 +174,7 @@ export function mediaFileReader(
* @param startingNode - The node to start the search, if ommitted, it will start at the root node.
* @param endingNode - The node to end the search, if ommitted, it will find all descendants of the startingNode.
* @returns An array of objects of all the nodes found by the search, including their depth into the tree.
* {depth: number, node: LexicalNode} It will always return at least 1 node (the ending node) so long as it exists
* \\{depth: number, node: LexicalNode\\} It will always return at least 1 node (the ending node) so long as it exists
*/
export function $dfs(
startingNode?: LexicalNode,
Expand Down
2 changes: 1 addition & 1 deletion packages/lexical-website/docs/concepts/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export type SerializedTextNode = SerializedTextNodeV1 | SerializedTextNodeV2;
```
### Handling extended HTML styling

Since the TextNode is foundational to all Lexical packages, including the plain text use case. Handling any rich text logic is undesirable. This creates the need to override the TextNode to handle serialization and deserialization of HTML/CSS styling properties to achieve full fidelity between JSON <-> HTML. Since this is a very popular use case, below we are proving a recipe to handle the most common use cases.
Since the TextNode is foundational to all Lexical packages, including the plain text use case. Handling any rich text logic is undesirable. This creates the need to override the TextNode to handle serialization and deserialization of HTML/CSS styling properties to achieve full fidelity between JSON \<-\> HTML. Since this is a very popular use case, below we are proving a recipe to handle the most common use cases.

You need to override the base TextNode:

Expand Down
11 changes: 11 additions & 0 deletions packages/lexical-website/docs/error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
id: error
title: Error Code
---
import { OssOnly } from 'docusaurus-plugin-internaldocs-fb/internal';
import ErrorCodePage from '@site/src/components/ErrorCodePage';

# Error Code
<OssOnly>
<ErrorCodePage/>
</OssOnly>
12 changes: 6 additions & 6 deletions packages/lexical-website/docs/getting-started/devtools.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ The easiest way to debug websites built with Lexical is to install the Lexical D
[link-firefox]: https://addons.mozilla.org/en-US/firefox/addon/lexical-developer-tools/ 'Version published on Mozilla Add-ons'
[link-safari]: https://apps.apple.com/us/app/lexical-developer-tools/id6502753400 'Version published on Mac App Store'

[<img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/chrome/chrome.svg" width="48" alt="Chrome" valign="middle">][link-chrome] [<img valign="middle" src="https://img.shields.io/chrome-web-store/v/kgljmdocanfjckcgfpcpdoklodllfdpc?style=flat&label=%20
">][link-chrome]
[<img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/chrome/chrome.svg" width="48" alt="Chrome" valign="middle"/>][link-chrome] [<img valign="middle" src="https://img.shields.io/chrome-web-store/v/kgljmdocanfjckcgfpcpdoklodllfdpc?style=flat&label=%20
"/>][link-chrome]

[<img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/edge/edge.svg" width="48" alt="Edge" valign="middle">][link-edge] [<img valign="middle" src="https://img.shields.io/badge/dynamic/json?label=%20&query=%24.version&url=https%3A%2F%2Fmicrosoftedge.microsoft.com%2Faddons%2Fgetproductdetailsbycrxid%2Fpclbkaofdgafcfhlnimcdhhkkhcabpcb">][link-edge]
[<img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/edge/edge.svg" width="48" alt="Edge" valign="middle"/>][link-edge] [<img valign="middle" src="https://img.shields.io/badge/dynamic/json?label=%20&query=%24.version&url=https%3A%2F%2Fmicrosoftedge.microsoft.com%2Faddons%2Fgetproductdetailsbycrxid%2Fpclbkaofdgafcfhlnimcdhhkkhcabpcb"/>][link-edge]

[<img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/firefox/firefox.svg" width="48" alt="Firefox" valign="middle">][link-firefox] [<img valign="middle" src="https://img.shields.io/amo/v/lexical-developer-tools.svg?label=%20">][link-firefox]
[<img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/firefox/firefox.svg" width="48" alt="Firefox" valign="middle"/>][link-firefox] [<img valign="middle" src="https://img.shields.io/amo/v/lexical-developer-tools.svg?label=%20"/>][link-firefox]

[<img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/safari/safari.svg" width="48" alt="Safari logo" valign="middle">][link-safari] [<img valign="middle" src="https://img.shields.io/itunes/v/6502753400?label=%20">][link-safari]
[<img src="https://cdnjs.cloudflare.com/ajax/libs/browser-logos/74.1.0/safari/safari.svg" width="48" alt="Safari logo" valign="middle"/>][link-safari] [<img valign="middle" src="https://img.shields.io/itunes/v/6502753400?label=%20"/>][link-safari]

Now, if you visit a website built with Lexical (such as [https://playground.lexical.dev/](https://playground.lexical.dev/)), you will see the _Lexical_ panel in your browser Inspector window.

<img src="/img/docs/devtools-demo.png" width="460" alt="Lexical Developer Tools Demo screenshot">
<img src="/img/docs/devtools-demo.png" width="460" alt="Lexical Developer Tools Demo screenshot"/>

## Extension Support

Expand Down
17 changes: 4 additions & 13 deletions packages/lexical-website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,6 @@ const config = {

favicon: 'img/favicon.ico',

markdown: {
format: 'md',
preprocessor: ({fileContent}) =>
fileContent.replaceAll(
'https://stackblitz.com/github/facebook/lexical/tree/main/',
STACKBLITZ_PREFIX,
),
},

onBrokenAnchors: 'throw',
// These are false positives when linking from API docs
onBrokenLinks: 'ignore',
Expand Down Expand Up @@ -273,9 +264,8 @@ const config = {

presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
require.resolve('docusaurus-plugin-internaldocs-fb/docusaurus-preset'),
{
blog: {
editUrl: `${GITHUB_REPO_URL}/tree/main/packages/lexical-website/blog/`,
showReadingTime: true, // TODO: Update when directory finalized
Expand All @@ -291,10 +281,11 @@ const config = {
gtag: {
trackingID: 'G-7C6YYBYBBT',
},
staticDocsProject: 'lexical',
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
},
],
],

Expand Down
2 changes: 1 addition & 1 deletion packages/lexical-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"typedoc-plugin-markdown": "^3.17.1",
"typedoc-plugin-rename-defaults": "^0.7.0",
"unist-util-visit": "^5.0.0",
"docusaurus-plugin-internaldocs-fb": "1.9.1"
"docusaurus-plugin-internaldocs-fb": "1.18.2"
},
"devDependencies": {
"buffer": "^6.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,29 @@
*/

import BrowserOnly from '@docusaurus/BrowserOnly';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout';
import {isInternal} from 'docusaurus-plugin-internaldocs-fb/internal';
import {useMemo} from 'react';

const codes = isInternal()
? []
: require('../../../../../../scripts/error-codes/codes.json');
const codes = require('../../../../scripts/error-codes/codes.json');

export default function ErrorCodePage() {
const {siteConfig} = useDocusaurusContext();
return (
<Layout description={siteConfig.tagline}>
<div className="flex flex-col pb-8 pt-4">
<h1>Error Code</h1>
<p>
In the minified production build of Lexical, we avoid sending down
full error messages in order to reduce the number of bytes sent over
the wire.
</p>
<div className="flex flex-col pb-8 pt-4">
<p>
In the minified production build of Lexical, we avoid sending down full
error messages in order to reduce the number of bytes sent over the
wire.
</p>

<p>
We highly recommend using the development build locally when debugging
your app since it tracks additional debug info and provides helpful
warnings about potential problems in your apps, but if you encounter
an exception while using the production build, this page will
reassemble the original text of the error.
</p>
<p>
We highly recommend using the development build locally when debugging
your app since it tracks additional debug info and provides helpful
warnings about potential problems in your apps, but if you encounter an
exception while using the production build, this page will reassemble
the original text of the error.
</p>

<BrowserOnly>{() => <ErrorFinder />}</BrowserOnly>
</div>
</Layout>
<BrowserOnly>{() => <ErrorFinder />}</BrowserOnly>
</div>
);
}

Expand Down
Loading