(el)
| 1089 | }; |
| 1090 | |
| 1091 | let _getSelectionInfo = function (el) { |
| 1092 | let selected = (el !== undefined && el !== null) ? el : _getSelectedJsonElement(); |
| 1093 | if (!selected.length) { |
| 1094 | return { |
| 1095 | selected: false, |
| 1096 | path: '', |
| 1097 | type: '', |
| 1098 | preview: '', |
| 1099 | text: '' |
| 1100 | }; |
| 1101 | } |
| 1102 | |
| 1103 | let path = _getJsonPathForElement(selected, 'javascript'); |
| 1104 | let text = ''; |
| 1105 | try { |
| 1106 | text = _stringifyJsonNodeValue(selected); |
| 1107 | } catch (e) { |
| 1108 | try { |
| 1109 | text = getJsonText(selected); |
| 1110 | } catch (err) { |
| 1111 | text = selected.text() || ''; |
| 1112 | } |
| 1113 | } |
| 1114 | |
| 1115 | let preview = _getDirectNodeText(selected) || text; |
| 1116 | preview = String(preview || '').replace(/\s+/g, ' ').trim(); |
| 1117 | if (preview.length > 140) { |
| 1118 | preview = preview.slice(0, 137) + '...'; |
| 1119 | } |
| 1120 | |
| 1121 | return { |
| 1122 | selected: true, |
| 1123 | path: path, |
| 1124 | type: _getJsonNodeType(selected, text), |
| 1125 | preview: preview, |
| 1126 | text: text |
| 1127 | }; |
| 1128 | }; |
| 1129 | |
| 1130 | let _emitSelectionChange = function (el) { |
| 1131 | try { |
no test coverage detected