mod.rs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. pub use auto_format::*;
  2. pub use default_insert::*;
  3. pub use preserve_inline_style::*;
  4. pub use reset_format_on_new_line::*;
  5. mod auto_format;
  6. mod default_insert;
  7. mod preserve_inline_style;
  8. mod reset_format_on_new_line;
  9. use crate::{
  10. client::extensions::InsertExt,
  11. core::{Delta, DeltaBuilder, DeltaIter, Operation},
  12. };
  13. pub struct PreserveBlockStyleOnInsertExt {}
  14. impl InsertExt for PreserveBlockStyleOnInsertExt {
  15. fn ext_name(&self) -> &str { "PreserveBlockStyleOnInsertExt" }
  16. fn apply(
  17. &self,
  18. _delta: &Delta,
  19. _replace_len: usize,
  20. _text: &str,
  21. _index: usize,
  22. ) -> Option<Delta> {
  23. None
  24. }
  25. }
  26. pub struct PreserveLineStyleOnSplitExt {}
  27. impl InsertExt for PreserveLineStyleOnSplitExt {
  28. fn ext_name(&self) -> &str { "PreserveLineStyleOnSplitExt" }
  29. fn apply(
  30. &self,
  31. _delta: &Delta,
  32. _replace_len: usize,
  33. _text: &str,
  34. _index: usize,
  35. ) -> Option<Delta> {
  36. None
  37. }
  38. }
  39. pub struct AutoExitBlockExt {}
  40. impl InsertExt for AutoExitBlockExt {
  41. fn ext_name(&self) -> &str { "AutoExitBlockExt" }
  42. fn apply(
  43. &self,
  44. _delta: &Delta,
  45. _replace_len: usize,
  46. _text: &str,
  47. _index: usize,
  48. ) -> Option<Delta> {
  49. None
  50. }
  51. }
  52. pub struct InsertEmbedsExt {}
  53. impl InsertExt for InsertEmbedsExt {
  54. fn ext_name(&self) -> &str { "InsertEmbedsExt" }
  55. fn apply(
  56. &self,
  57. _delta: &Delta,
  58. _replace_len: usize,
  59. _text: &str,
  60. _index: usize,
  61. ) -> Option<Delta> {
  62. None
  63. }
  64. }
  65. pub struct ForceNewlineForInsertsAroundEmbedExt {}
  66. impl InsertExt for ForceNewlineForInsertsAroundEmbedExt {
  67. fn ext_name(&self) -> &str { "ForceNewlineForInsertsAroundEmbedExt" }
  68. fn apply(
  69. &self,
  70. _delta: &Delta,
  71. _replace_len: usize,
  72. _text: &str,
  73. _index: usize,
  74. ) -> Option<Delta> {
  75. None
  76. }
  77. }