You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					24 lines
				
				544 B
			
		
		
			
		
	
	
					24 lines
				
				544 B
			| 
								 
											4 years ago
										 
									 | 
							
								import Inline from '../blots/inline';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class Script extends Inline {
							 | 
						||
| 
								 | 
							
								  static create(value) {
							 | 
						||
| 
								 | 
							
								    if (value === 'super') {
							 | 
						||
| 
								 | 
							
								      return document.createElement('sup');
							 | 
						||
| 
								 | 
							
								    } else if (value === 'sub') {
							 | 
						||
| 
								 | 
							
								      return document.createElement('sub');
							 | 
						||
| 
								 | 
							
								    } else {
							 | 
						||
| 
								 | 
							
								      return super.create(value);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  static formats(domNode) {
							 | 
						||
| 
								 | 
							
								    if (domNode.tagName === 'SUB') return 'sub';
							 | 
						||
| 
								 | 
							
								    if (domNode.tagName === 'SUP') return 'super';
							 | 
						||
| 
								 | 
							
								    return undefined;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								Script.blotName = 'script';
							 | 
						||
| 
								 | 
							
								Script.tagName = ['SUB', 'SUP'];
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export default Script;
							 |