diff --git a/app/soapbox/features/compose/editor/LICENSE b/app/soapbox/features/compose/editor/LICENSE new file mode 100644 index 0000000000..969d061e8b --- /dev/null +++ b/app/soapbox/features/compose/editor/LICENSE @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/app/soapbox/features/compose/editor/index.tsx b/app/soapbox/features/compose/editor/index.tsx index fd4cee2ac6..7fe57c9756 100644 --- a/app/soapbox/features/compose/editor/index.tsx +++ b/app/soapbox/features/compose/editor/index.tsx @@ -1,3 +1,12 @@ +/* +MIT License + +Copyright (c) Meta Platforms, Inc. and affiliates. + +This source code is licensed under the MIT license found in the +LICENSE file in the /app/soapbox/features/compose/editor directory. +*/ + import { $convertToMarkdownString, TRANSFORMERS, @@ -19,8 +28,6 @@ import nodes from './nodes'; import FloatingLinkEditorPlugin from './plugins/floating-link-editor-plugin'; import FloatingTextFormatToolbarPlugin from './plugins/floating-text-format-toolbar-plugin'; -// import type { EditorState } from 'lexical'; - const initialConfig: InitialConfigType = { namespace: 'ComposeForm', onError: console.error, diff --git a/app/soapbox/features/compose/editor/nodes.ts b/app/soapbox/features/compose/editor/nodes.ts index 9f07ebfcf1..50aae08be2 100644 --- a/app/soapbox/features/compose/editor/nodes.ts +++ b/app/soapbox/features/compose/editor/nodes.ts @@ -1,74 +1,27 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ +/* +MIT License +Copyright (c) Meta Platforms, Inc. and affiliates. + +This source code is licensed under the MIT license found in the +LICENSE file in the /app/soapbox/features/compose/editor directory. +*/ import { CodeHighlightNode, CodeNode } from '@lexical/code'; -// import { HashtagNode } from '@lexical/hashtag'; import { AutoLinkNode, LinkNode } from '@lexical/link'; -// import { ListItemNode, ListNode } from '@lexical/list'; -// import { MarkNode } from '@lexical/mark'; -// import { OverflowNode } from '@lexical/overflow'; import { HorizontalRuleNode } from '@lexical/react/LexicalHorizontalRuleNode'; import { HeadingNode, QuoteNode } from '@lexical/rich-text'; -// import { TableCellNode, TableNode, TableRowNode } from '@lexical/table'; - -// import { CollapsibleContainerNode } from '../plugins/CollapsiblePlugin/CollapsibleContainerNode'; -// import { CollapsibleContentNode } from '../plugins/CollapsiblePlugin/CollapsibleContentNode'; -// import { CollapsibleTitleNode } from '../plugins/CollapsiblePlugin/CollapsibleTitleNode'; - -// import { AutocompleteNode } from './AutocompleteNode'; -// import { EmojiNode } from './EmojiNode'; -// import { EquationNode } from './EquationNode'; -// import { ExcalidrawNode } from './ExcalidrawNode'; -// import { FigmaNode } from './FigmaNode'; -// import { ImageNode } from './ImageNode'; -// import { KeywordNode } from './KeywordNode'; -// import { MentionNode } from './MentionNode'; -// import { PollNode } from './PollNode'; -// import { StickyNode } from './StickyNode'; -// import { TableNode as NewTableNode } from './TableNode'; -// import { TweetNode } from './TweetNode'; -// import { YouTubeNode } from './YouTubeNode'; import type { Klass, LexicalNode } from 'lexical'; const PlaygroundNodes: Array> = [ HeadingNode, - // ListNode, - // ListItemNode, QuoteNode, CodeNode, - // NewTableNode, - // TableNode, - // TableCellNode, - // TableRowNode, - // HashtagNode, CodeHighlightNode, AutoLinkNode, LinkNode, - // OverflowNode, - // PollNode, - // StickyNode, - // ImageNode, - // MentionNode, - // EmojiNode, - // ExcalidrawNode, - // EquationNode, - // AutocompleteNode, - // KeywordNode, HorizontalRuleNode, - // TweetNode, - // YouTubeNode, - // FigmaNode, - // MarkNode, - // CollapsibleContainerNode, - // CollapsibleContentNode, - // CollapsibleTitleNode, ]; export default PlaygroundNodes; diff --git a/app/soapbox/features/compose/editor/plugins/floating-link-editor-plugin.tsx b/app/soapbox/features/compose/editor/plugins/floating-link-editor-plugin.tsx index eefa1a57f6..6e6d6259d0 100644 --- a/app/soapbox/features/compose/editor/plugins/floating-link-editor-plugin.tsx +++ b/app/soapbox/features/compose/editor/plugins/floating-link-editor-plugin.tsx @@ -1,10 +1,11 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ +/* +MIT License + +Copyright (c) Meta Platforms, Inc. and affiliates. + +This source code is licensed under the MIT license found in the +LICENSE file in the /app/soapbox/features/compose/editor directory. +*/ import { $isAutoLinkNode, $isLinkNode, TOGGLE_LINK_COMMAND } from '@lexical/link'; import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'; diff --git a/app/soapbox/features/compose/editor/plugins/floating-text-format-toolbar-plugin.tsx b/app/soapbox/features/compose/editor/plugins/floating-text-format-toolbar-plugin.tsx index bdd85528ed..6e86a57799 100644 --- a/app/soapbox/features/compose/editor/plugins/floating-text-format-toolbar-plugin.tsx +++ b/app/soapbox/features/compose/editor/plugins/floating-text-format-toolbar-plugin.tsx @@ -1,12 +1,11 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ +/* +MIT License -// import './index.css'; +Copyright (c) Meta Platforms, Inc. and affiliates. + +This source code is licensed under the MIT license found in the +LICENSE file in the /app/soapbox/features/compose/editor directory. +*/ import { $isCodeHighlightNode } from '@lexical/code'; import { $isLinkNode, TOGGLE_LINK_COMMAND } from '@lexical/link'; diff --git a/app/soapbox/features/compose/editor/plugins/link-plugin.tsx b/app/soapbox/features/compose/editor/plugins/link-plugin.tsx index 044daab4a0..c892a294a9 100644 --- a/app/soapbox/features/compose/editor/plugins/link-plugin.tsx +++ b/app/soapbox/features/compose/editor/plugins/link-plugin.tsx @@ -1,10 +1,11 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ +/* +MIT License + +Copyright (c) Meta Platforms, Inc. and affiliates. + +This source code is licensed under the MIT license found in the +LICENSE file in the /app/soapbox/features/compose/editor directory. +*/ import { LinkPlugin as LexicalLinkPlugin } from '@lexical/react/LexicalLinkPlugin'; import * as React from 'react'; diff --git a/app/soapbox/features/compose/editor/utils/get-dom-range-rect.ts b/app/soapbox/features/compose/editor/utils/get-dom-range-rect.ts index 9fc103fcc7..bf9c6b8c3f 100644 --- a/app/soapbox/features/compose/editor/utils/get-dom-range-rect.ts +++ b/app/soapbox/features/compose/editor/utils/get-dom-range-rect.ts @@ -1,11 +1,14 @@ +/* +MIT License + +Copyright (c) Meta Platforms, Inc. and affiliates. + +This source code is licensed under the MIT license found in the +LICENSE file in the /app/soapbox/features/compose/editor directory. +*/ + /* eslint-disable eqeqeq */ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ + export const getDOMRangeRect = ( nativeSelection: Selection, rootElement: HTMLElement, diff --git a/app/soapbox/features/compose/editor/utils/get-selected-node.ts b/app/soapbox/features/compose/editor/utils/get-selected-node.ts index e7f89802df..c4522c12c4 100644 --- a/app/soapbox/features/compose/editor/utils/get-selected-node.ts +++ b/app/soapbox/features/compose/editor/utils/get-selected-node.ts @@ -1,10 +1,12 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ +/* +MIT License + +Copyright (c) Meta Platforms, Inc. and affiliates. + +This source code is licensed under the MIT license found in the +LICENSE file in the /app/soapbox/features/compose/editor directory. +*/ + import { $isAtNodeEnd } from '@lexical/selection'; import { ElementNode, RangeSelection, TextNode } from 'lexical'; diff --git a/app/soapbox/features/compose/editor/utils/set-floating-elem-position.ts b/app/soapbox/features/compose/editor/utils/set-floating-elem-position.ts index 6d39488210..64ede997e5 100644 --- a/app/soapbox/features/compose/editor/utils/set-floating-elem-position.ts +++ b/app/soapbox/features/compose/editor/utils/set-floating-elem-position.ts @@ -1,10 +1,12 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ +/* +MIT License + +Copyright (c) Meta Platforms, Inc. and affiliates. + +This source code is licensed under the MIT license found in the +LICENSE file in the /app/soapbox/features/compose/editor directory. +*/ + const VERTICAL_GAP = 10; const HORIZONTAL_OFFSET = 5; diff --git a/app/soapbox/features/compose/editor/utils/url.ts b/app/soapbox/features/compose/editor/utils/url.ts index 296787ea13..3d0192d07c 100644 --- a/app/soapbox/features/compose/editor/utils/url.ts +++ b/app/soapbox/features/compose/editor/utils/url.ts @@ -1,10 +1,11 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ +/* +MIT License + +Copyright (c) Meta Platforms, Inc. and affiliates. + +This source code is licensed under the MIT license found in the +LICENSE file in the /app/soapbox/features/compose/editor directory. +*/ export const sanitizeUrl = (url: string): string => { /** A pattern that matches safe URLs. */