-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Release] Hotfix 2.21.4 => 2.21.5 (patch) (#10235)
* chore: bump version 2.21.5 * fix: lens icon crash on conversation group (#10233) (#10245) * fix: post replacer (#10248) * chore: update lock file * refactor: injectPostReplacer * chore: disable PostReplacer * refactor: code style * fix: not more replacing promotion & collapsed posts * refactor: posts have a tag link will be replaced * fix: twitter requests need another new feature option (#10247) * fix: read of undefined (#10250) * refactor: do not replace post includes videos (#10251) --------- Co-authored-by: UncleBill <billbill290@gmail.com>
- Loading branch information
1 parent
2a027e4
commit e5ac023
Showing
16 changed files
with
85 additions
and
120 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
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
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
27 changes: 12 additions & 15 deletions
27
packages/mask/src/social-network/defaults/inject/PostReplacer.tsx
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 |
---|---|---|
@@ -1,40 +1,37 @@ | ||
import { memo } from 'react' | ||
import { attachReactTreeWithContainer } from '../../../utils/shadow-root/renderInShadowRoot.js' | ||
import type { DOMProxy } from '@dimensiondev/holoflows-kit' | ||
import { PostInfoProvider, type PostInfo } from '@masknet/plugin-infra/content-script' | ||
import { attachReactTreeWithContainer } from '../../../utils/shadow-root/renderInShadowRoot.js' | ||
import { PostReplacer, type PostReplacerProps } from '../../../components/InjectedComponents/PostReplacer.js' | ||
import type { DOMProxy } from '@dimensiondev/holoflows-kit' | ||
import { noop } from 'lodash-es' | ||
|
||
export function injectPostReplacer(config: injectPostReplacerConfig = {}) { | ||
interface InjectPostReplacerConfig { | ||
zipPost(node: DOMProxy): void | ||
unzipPost(node: DOMProxy): void | ||
} | ||
|
||
export function injectPostReplacer({ zipPost, unzipPost }: InjectPostReplacerConfig) { | ||
const PostReplacerDefault = memo(function PostReplacerDefault(props: { | ||
zipPost: PostReplacerProps['zip'] | ||
unZipPost: PostReplacerProps['unzip'] | ||
}) { | ||
return <PostReplacer zip={props.zipPost} unzip={props.unZipPost} /> | ||
}) | ||
|
||
const { zipPost, unzipPost } = config | ||
const zipPostF = zipPost || noop | ||
const unzipPostF = unzipPost || noop | ||
return function injectPostReplacer(current: PostInfo, signal: AbortSignal) { | ||
signal.addEventListener('abort', unzipPostF) | ||
signal.addEventListener('abort', unzipPost as () => void) | ||
|
||
attachReactTreeWithContainer(current.rootElement.afterShadow, { | ||
key: 'post-replacer', | ||
untilVisible: true, | ||
signal, | ||
}).render( | ||
<PostInfoProvider post={current}> | ||
<PostReplacerDefault | ||
zipPost={() => zipPostF(current.rootElement)} | ||
unZipPost={() => unzipPostF(current.rootElement)} | ||
zipPost={() => zipPost(current.rootElement)} | ||
unZipPost={() => unzipPost(current.rootElement)} | ||
{...current} | ||
/> | ||
</PostInfoProvider>, | ||
) | ||
} | ||
} | ||
|
||
interface injectPostReplacerConfig { | ||
zipPost?(node: DOMProxy): void | ||
unzipPost?(node: DOMProxy): void | ||
} |
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
Oops, something went wrong.