question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature: support for subscript and superscript

See original GitHub issue

Hi! I have to add a button for subscript in the editor toolbar. But turns out, the subscript and superscript functionalities aren’t fully implemented. I did see a few variables (IS_SUBSCRIPT, IS_SUPERSCRIPT) in the source code, but I didn’t see them being used anywhere. I also went through the doc, but wasn’t able to find anything of much relevance. So I just wanted to know the state of this feature. Also, please let me know if I am missing something. Thanks 😃

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
Profulcommented, Apr 20, 2022

It is available as part of TextFormatType

Like strikethrough implementation you have to implement for ‘subscript’ or ‘superscript’

  1. You have to add class name here PlaygroundEditorTheme.js
  2. Provide CSS style here PlaygroundEditorTheme.css
  3. editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'superscript')
1reaction
acywatsoncommented, Apr 20, 2022

thanks @Proful. Any clue why are we using CSS to implement this rather than using <sup> and <sub> tags?

Maybe we should be? We can look into it. I guess the classes might be more flexible than relying on browser styling, but now I’m thinking about the semantics of not having the tags.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Format text as superscript or subscript - Microsoft Support
Insert a subscript or superscript symbol or apply superscript or subscript formatting to text in PowerPoint in Windows and Mac.Also try keyboard shortcuts ......
Read more >
Subscript and superscript - Wikipedia
A subscript or superscript is a character (such as a number or letter) that is set slightly below or above the normal line...
Read more >
6 Methods for Typing Subscript or Superscript Characters
1. Instructions for typing subscript and superscript characters in Word · Open the Word document you want to insert subscript or superscript ......
Read more >
How to use superscript and subscript in Google Docs
The quickest way to apply a superscript or a subscript in Google Docs on the web is with a keyboard shortcut. On a...
Read more >
How to use superscript, subscript, and footnotes in Datawrapper
Superscripts are characters set above the normal line of type (e.g., in 2ⁿᵈ) and subscripts are characters set below (e.g., in Cᵥₑₓ).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found