Summernote.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace addons\summernote;
  3. use think\Addons;
  4. /**
  5. * Summernote富文本编辑器
  6. */
  7. class Summernote extends Addons
  8. {
  9. /**
  10. * 插件安装方法
  11. * @return bool
  12. */
  13. public function install()
  14. {
  15. return true;
  16. }
  17. /**
  18. * 插件卸载方法
  19. * @return bool
  20. */
  21. public function uninstall()
  22. {
  23. return true;
  24. }
  25. /**
  26. * @param $params
  27. */
  28. public function configInit(&$params)
  29. {
  30. $config = $this->getConfig();
  31. $params['summernote'] = [
  32. 'classname' => $config['classname'] ?? '.editor',
  33. 'height' => $config['height'] ?? 250,
  34. 'minHeight' => $config['minHeight'] ?? 250,
  35. 'placeholder' => $config['placeholder'] ?? '',
  36. 'followingToolbar' => $config['followingToolbar'] ?? 0,
  37. 'airMode' => $config['airMode'] ?? 0,
  38. 'toolbar' => (array)json_decode($config['toolbar'] ?? '', true),
  39. ];
  40. }
  41. }