feat: 枠線をつけるMFMを追加 (#12981)
* Update MkMisskeyFlavoredMarkdown.ts * Update const.ts * Update MkMisskeyFlavoredMarkdown.ts * Update MkMisskeyFlavoredMarkdown.ts * Update CHANGELOG.md
This commit is contained in:
		
							parent
							
								
									4846ab077b
								
							
						
					
					
						commit
						bc8a741e14
					
				
					 3 changed files with 25 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -21,6 +21,7 @@
 | 
			
		|||
### Client
 | 
			
		||||
- Feat: 新しいゲームを追加
 | 
			
		||||
- Feat: 絵文字の詳細ダイアログを追加
 | 
			
		||||
- Feat: 枠線をつけるMFM`$[border.width=1,style=solid,color=fff,radius=0 ...]`を追加
 | 
			
		||||
- Enhance: ハッシュタグ入力時に、本文の末尾の行に何も書かれていない場合は新たにスペースを追加しないように
 | 
			
		||||
- Enhance: チャンネルノートのピン留めをノートのメニューからできるように
 | 
			
		||||
- Enhance: 管理者の場合はAPI tokenの発行画面で管理機能に関する権限を付与できるように
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,7 +61,12 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
 | 
			
		|||
		if (t == null) return null;
 | 
			
		||||
		return t.match(/^[0-9.]+s$/) ? t : null;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	const validColor = (c: string | null | undefined): string | null => {
 | 
			
		||||
		if (c == null) return null;
 | 
			
		||||
		return c.match(/^[0-9a-f]{3,6}$/i) ? c : null;
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	const useAnim = defaultStore.state.advancedMfm && defaultStore.state.animatedMfm;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
| 
						 | 
				
			
			@ -240,17 +245,30 @@ export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
 | 
			
		|||
						break;
 | 
			
		||||
					}
 | 
			
		||||
					case 'fg': {
 | 
			
		||||
						let color = token.props.args.color;
 | 
			
		||||
						if (!/^[0-9a-f]{3,6}$/i.test(color)) color = 'f00';
 | 
			
		||||
						let color = validColor(token.props.args.color);
 | 
			
		||||
						color = color ?? 'f00';
 | 
			
		||||
						style = `color: #${color}; overflow-wrap: anywhere;`;
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
					case 'bg': {
 | 
			
		||||
						let color = token.props.args.color;
 | 
			
		||||
						if (!/^[0-9a-f]{3,6}$/i.test(color)) color = 'f00';
 | 
			
		||||
						let color = validColor(token.props.args.color);
 | 
			
		||||
						color = color ?? 'f00';
 | 
			
		||||
						style = `background-color: #${color}; overflow-wrap: anywhere;`;
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
					case 'border': {
 | 
			
		||||
						let color = validColor(token.props.args.color);
 | 
			
		||||
						color = color ? `#${color}` : 'var(--accent)';
 | 
			
		||||
						let b_style = token.props.args.style;
 | 
			
		||||
						if (
 | 
			
		||||
							!['hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset']
 | 
			
		||||
								.includes(b_style)
 | 
			
		||||
						) b_style = 'solid';
 | 
			
		||||
						const width = parseFloat(token.props.args.width ?? '1');
 | 
			
		||||
						const radius = parseFloat(token.props.args.radius ?? '0');
 | 
			
		||||
						style = `border: ${width}px ${b_style} ${color}; border-radius: ${radius}px`;
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
					case 'ruby': {
 | 
			
		||||
						if (token.children.length === 1) {
 | 
			
		||||
							const child = token.children[0];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -108,4 +108,4 @@ export const DEFAULT_SERVER_ERROR_IMAGE_URL = 'https://xn--931a.moe/assets/error
 | 
			
		|||
export const DEFAULT_NOT_FOUND_IMAGE_URL = 'https://xn--931a.moe/assets/not-found.jpg';
 | 
			
		||||
export const DEFAULT_INFO_IMAGE_URL = 'https://xn--931a.moe/assets/info.jpg';
 | 
			
		||||
 | 
			
		||||
export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'scale', 'position', 'fg', 'bg', 'font', 'blur', 'rainbow', 'sparkle', 'rotate', 'ruby', 'unixtime'];
 | 
			
		||||
export const MFM_TAGS = ['tada', 'jelly', 'twitch', 'shake', 'spin', 'jump', 'bounce', 'flip', 'x2', 'x3', 'x4', 'scale', 'position', 'fg', 'bg', 'border', 'font', 'blur', 'rainbow', 'sparkle', 'rotate', 'ruby', 'unixtime'];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue