-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fix paster exports and registration
- Loading branch information
Showing
6 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import {ICopyable, CopyData} from '../interfaces/i_copyable.js'; | ||
import type {IPaster} from '../interfaces/i_paster.js'; | ||
import * as registry from '../registry.js'; | ||
|
||
/** | ||
* Registers the given paster so that it cna be used for pasting. | ||
* | ||
* @param type The type of the paster to register, e.g. 'block', 'comment', etc. | ||
* @param paster The paster to register. | ||
*/ | ||
export function register<U extends CopyData, T extends ICopyable>( | ||
type: string, | ||
paster: IPaster<U, T>, | ||
) { | ||
registry.register(registry.Type.PASTER, type, paster); | ||
} | ||
|
||
/** | ||
* Unregisters the paster associated with the given type. | ||
* | ||
* @param type The type of the paster to unregister. | ||
*/ | ||
export function unregister(type: string) { | ||
registry.unregister(registry.Type.PASTER, type); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters