在 ShinyBS 中增加 tooltip/popover 的长度

Increase length of tooltip/popover in ShinyBS

ShinyBS 包提供了一种向 Shiny 应用程序的元素添加工具提示和弹出框的简便方法。然而,它们的长度被严格限制在 40 个字符左右。我真的需要增加这些工具提示中允许的字符数。

一个例子:

library(shiny)
library(shinyBS)

shinyApp(
  ui = fluidPage(
      column(5,sliderInput("n", "Short tooltip", 5, 100, 20),
                   bsTooltip("n",title="This is a short tooltip, so it works."),
                   sliderInput("n2", "Long tooltip", 5, 100, 20),
                   bsTooltip("n2",title="This is a longer tooltip, so it doesn't work."))
  ), 
  server = function(input, output) {}
)

实际上是第二个工具提示的标题中存在未转义的 ' 导致您出现问题,而不是标题的长度。输入 \' 代替每个 ' 将解决问题。

试试 运行 这个(或者,就此而言,?bsTooltip 中的示例)看看长标题的工具提示是否正常工作:

library(shiny)
library(shinyBS)

shinyApp(
  ui = fluidPage(
      column(5,
             sliderInput("n", "Short tooltip", 5, 100, 20),
             bsTooltip("n",title="This is a short tooltip, so it works."),
             sliderInput("n2", "Long tooltip", 5, 100, 20),
             bsTooltip("n2",title="This is a longer tooltip, which\'ll still work, as long as each special character is escaped with a \\\\."))
  ), 
  server = function(input, output) {}
)