Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
add deprecation notices
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoffrey Chong committed Nov 15, 2023
1 parent d793910 commit 75b1a17
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/commands/addMark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { EditorState, Transaction } from "prosemirror-state"
import { MarkType } from "prosemirror-model"

/** Wrap the users current selection in the given Mark type */
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export const addMark: CommandFactory =
(type: MarkType, attrs?: Record<string, unknown>) =>
(state: EditorState, dispatch?: (tx: Transaction) => void) => {
Expand Down
3 changes: 3 additions & 0 deletions src/commands/getMarkAttrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { Mark, MarkType } from "prosemirror-model"
** Filters through the states Marks and returns the attributes
** of the Mark found, else returns and empty object
*/
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function getMarkAttrs(
state: EditorState,
type: MarkType
Expand Down
3 changes: 3 additions & 0 deletions src/commands/getMarkRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { MarkType, ResolvedPos } from "prosemirror-model"
// Note: this doesn't handle selections _across_ nodes.
// At the time of writing the implication of this is on links: they cannot span across multiple nodes.
// There's no impact on the other marks like bold, italics and underline.
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function getMarkRange(
$pos: ResolvedPos | null = null,
type: MarkType | null = null
Expand Down
3 changes: 3 additions & 0 deletions src/commands/listIsActive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { EditorState } from "prosemirror-state"
import { NodeType } from "prosemirror-model"
import { findParentNodeOfTypeClosestToPos } from "prosemirror-utils"

/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function listIsActive(
state: EditorState,
type: NodeType,
Expand Down
3 changes: 3 additions & 0 deletions src/commands/markContainsSelection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { getMarkRange } from "./getMarkRange"
import { markIsActive } from "./markIsActive"

/** Check the current PM Selection against the Mark Type provided */
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function markContainsSelection(
state: EditorState,
markType: MarkType
Expand Down
3 changes: 3 additions & 0 deletions src/commands/markIsActive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { EditorState } from "prosemirror-state"
import { MarkType } from "prosemirror-model"

/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function markIsActive(state: EditorState, type: MarkType) {
const { from, $from, to, empty } = state.selection

Expand Down
3 changes: 3 additions & 0 deletions src/commands/removeMark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { MarkType } from "prosemirror-model"
import { getMarkRange } from "./getMarkRange"

/** Remove part or all of the Mark from the current selection */
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export const removeMark: CommandFactory =
(
type: MarkType,
Expand Down
3 changes: 3 additions & 0 deletions src/commands/updateMark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { MarkType } from "prosemirror-model"
import { getMarkRange } from "./getMarkRange"

/** Update Mark attributes, create nested Marks or split Marks of the same type */
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export const updateMark: CommandFactory =
(
type: MarkType,
Expand Down
3 changes: 3 additions & 0 deletions src/commands/validateAndRemoveMarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export type AttrsValidator = (
// This is a variation on the removeMark transform in
// https://github.com/ProseMirror/prosemirror-transform/blob/master/src/mark.js#L44
/** This will walk the full doc and remove the Marks that fail the validator method */
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function validateAndRemoveMarks(
markType: MarkType,
validator: AttrsValidator
Expand Down
3 changes: 3 additions & 0 deletions src/core/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ type EditorArgs = {
* createRichTextEditor
* Initialize a ProseMirror EditorView
*/
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function createRichTextEditor({
initialEditorState,
node,
Expand Down
3 changes: 3 additions & 0 deletions src/core/hooks/useRichTextEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ type UseRichTextEditorReturnValue = [
* @param {initialEditorState} ProseMirror state
* @returns {Array}
*/
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function useRichTextEditor(
initialEditorState: EditorState,
/*
Expand Down
6 changes: 6 additions & 0 deletions src/core/inputrules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { wrappingInputRule } from "prosemirror-inputrules"
// Given a list node type, returns an input rule that turns a number
// followed by a dot at the start of a textblock into an ordered list.
// Copied from https://github.com/ProseMirror/prosemirror-example-setup/blob/master/src/inputrules.js
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function orderedListRule(nodeType: NodeType) {
return wrappingInputRule(
/^(\d+)\.\s$/,
Expand All @@ -17,6 +20,9 @@ export function orderedListRule(nodeType: NodeType) {
// (dash, plush, or asterisk) at the start of a textblock into a
// bullet list.
// Copied from https://github.com/ProseMirror/prosemirror-example-setup/blob/master/src/inputrules.js
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function bulletListRule(nodeType: NodeType) {
return wrappingInputRule(/^\s*([-+*])\s$/, nodeType)
}
9 changes: 9 additions & 0 deletions src/core/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { Node, Schema } from "prosemirror-model"
* Create a ProseMirror EditorState. Wrapper for EditorState.create to make the
* API obvious to consumers
*/
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function createEditorState(
schema: Schema,
doc: Node | undefined,
Expand All @@ -23,6 +26,9 @@ export function createEditorState(
* Create a ProseMirror doc node from the combination of a schema and the object
* representation of a document
*/
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function createDocNode(schema: Schema, docObject: Doc) {
return Node.fromJSON(schema, docObject)
}
Expand All @@ -31,6 +37,9 @@ export function createDocNode(schema: Schema, docObject: Doc) {
* Create a ProseMirror doc node from the combination of a schema and the doc’s
* content array (rather than the top-level doc node).
*/
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function createDocNodeFromContent(
schema: Schema,
docContent: DocContent
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/LinkManager/LinkManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import { MarkType } from "prosemirror-model"
import { SelectionPosition } from "./types.d"
import { createReactTooltipWrapper } from "./createReactTooltipWrapper"
import debounce from "lodash.debounce"

/**
* @deprecated Please use the same component from `@kaizen/components`
*/
class LinkManager {
editorComponent: ComponentType<LinkEditorProps>
linkActive: (state: EditorState) => boolean
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/LinkManager/components/LinkEditor/LinkEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export type LinkEditorProps = {
focusEditor: () => void
}

/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function LinkEditor({
attrs,
removeMark,
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/LinkManager/components/LinkModal/LinkModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ interface LinkModalProps {
defaultHref?: string
}

/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export const LinkModal: React.VFC<LinkModalProps> = props => {
const { onSubmit, onDismiss, onAfterLeave, isOpen, defaultHref } = props
const [href, setHref] = useState<string>(defaultHref || "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export interface LinkPopoverProps {
selectionPosition: SelectionPosition
}

/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export const LinkPopover: React.VFC<LinkPopoverProps> = props => {
const { href, onRemove, onEdit, selectionPosition } = props
const [ElementRef, Popover] = usePopover()
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/LinkManager/createReactTooltipWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ function Wrapper({
* Create a wrapping connector for rendering a React element into a separate
* part of the DOM while being able to update it without remounting.
*/
/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export function createReactTooltipWrapper(
parentNode: HTMLElement,
Component: ElementType,
Expand Down
3 changes: 3 additions & 0 deletions src/schema/marks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { MarkSpec, Node } from "prosemirror-model"
import { marks as proseMarks } from "prosemirror-schema-basic"
import { validateLink } from "../plugins/LinkManager/validation"

/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export const marks: MarkSpec = {
...proseMarks,

Expand Down
3 changes: 3 additions & 0 deletions src/schema/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const proseNodesWithCamelCase = {
codeBlock: proseNodes.code_block,
}

/**
* @deprecated Please use the same component from `@kaizen/components`
*/
export const nodes: NodeSpec = {
...proseNodesWithCamelCase,
orderedList: {
Expand Down

0 comments on commit 75b1a17

Please sign in to comment.